Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I’ve got a webcam and want to dump a frame once a second to disk. A command like this works well to drop 5 frames per second to disk:

./ffmpeg -y -f video4linux2 -input_format mjpeg -r 5 -i /dev/video0 -c:v copy -bsf:v mjpeg2jpeg images/frame_%d.jpg

But 5 FPS is as low as my webcam can go. Setting any lower and it just corrects back to 5 FPS. I haven’t been able to figure out how to effectively get 1 FPS out of it. It seemed like maybe the select video filter was a good candidate. But, I’ve placed it in a number of positions of the command line to no avail.

./ffmpeg -y -f video4linux2 -input_format mjpeg -r 5 -i /dev/video0 -c:v copy -bsf:v mjpeg2jpeg -vf select='not(mod(n\,5))' images/frame_%d.jpg
./ffmpeg -y -vf select='not(mod(n\,5))' -f video4linux2 -input_format mjpeg -r 5 -i /dev/video0 -c:v copy -bsf:v mjpeg2jpeg images/frame_%d.jpg
./ffmpeg -y -f video4linux2 -input_format mjpeg -r 5 -i /dev/video0 -vf select='not(mod(n\,5))' -c:v copy -bsf:v mjpeg2jpeg images/frame_%d.jpg

Does anyone know how I can get 1 FPS from a webcam using ffmpeg? This question is similar to Extracting "one of every 10 frames" in a video using VLC or FFmpeg but I just can't get the select filter to work and I think it's due to it being a live source.

share|improve this question

You must log in to answer this question.

Browse other questions tagged .