Search code examples
videoffmpegmjpeg

Which frame does ffmpeg get when reducing the frame rate


I have some video that I would like to convert to images of frames every 2 sec.

E.g. If the video is 7 seconds long at 15 fps I would like to get frames 1, 31, 61, 91.

The command:

ffmpeg -i foo.mp4 -r 0.5  -f image2 -vcodec mjpeg foo%d.jpg

appears to do what I want, but which frame does it get? 1, 31, 61, 91 or 30, 60, 90 or 13, 43, 73, 103?


Solution

  • The first image will be from the very first frame.

    Note that you very well may get an image or two more that you expect. I believe this is because of rounding and/or that ffmpeg creates a final images. E.g.: Is your video really 7s long? Or is it 7.63s long?