Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.