Default frame rate for image inputs is 25. You can change it with the
-framerate input option. Example for 24 fps:
ffmpeg -framerate 24 -i input_%03d.jpg -vf format=yuv420p output.mp4
-vf format=yuv420p (or the legacy alias
-pix_fmt yuv420p) will ensure compatible chroma subsampling for MP4. Otherwise,
ffmpeg will try to preserve color fidelity, but most players can't handle advanced chroma subsampling.
- The output will use the same frame rate as the input. So you do not need to set an output frame rate. But there are a few reasons to do so. See Using a different frame rate for image inputs and video output below.
-r output option:
ffmpeg -i input.mp4 -r 25 output.mp4
Using a different frame rate for image inputs and video output
Why? For example, you may want all images to be displayed for 1 second each (1 fps). But most players can't play very low frame rates (about 6 fps or lower). So you can make
ffmpeg use a different output frame rate. The output will look like 1 fps, but will actually be a normal frame rate, such as 25 fps.
Example: input images at 1 fps, but make the output 25 fps.
ffmpeg -framerate 1 -i input_%03d.png -r 25 output.mp4
- Frames will be duplicated or dropped to match the desired output frame rate.
- The image demuxer uses
-framerate, while the output frame rate is set using
Error: Option framerate not found
- Is not a generic option. It doesn't work for everything.
- Is only an input option.
- Only works with certain demuxers (including: images, x11grab, rawvideo).
- You probably only need to use the
-r output option. See the Video inputs section above.
-framerateparameter to get the desired results.