There are two frame rates to consider: the input and the output.
By default the input frame rate is 25, and the output will use the same frame rate as the input unless you tell it otherwise.
Same frame rate for input and output
If you want to input and output to have the same frame rate, then just provide the input frame rate. This example will set a frame rate of 30000/1001 (NTSC video):
ffmpeg -framerate 30000/1001 -i input output.mp4
Alternatively, in this example, you could use
ntsc instead of
30000/1001, but don't use
29.97 because that is not accurate or correct. See other frame rate aliases.
Because the default input frame rate is 25, and if you only set an output frame rate, then frames will be dropped or duplicated to compensate. That is why the input frame rate is set in this situation.
Different frame rate for input and output
Sometimes you may want the input frame rate and output frame rate to differ. For example, you may want to input the frames at a certain rate, and then duplicate or drop frames so the output has a different frame rate. You may want to do this due to compatibility issues with your output format container, your player, and/or your device:
ffmpeg -framerate 10 -i input -r 25 output.mp4
In this example frames will be duplicated to go from 10 to 25. The console output will tell you if frames are being dropped or duplicated.
The image file demuxer uses
-framerate, while the output frame rate is set using
You may have to add the
-pix_fmt yuv420p option in some circumstances if you're outputting H.264 video (the
ffmpeg console output will warn you if you do need to). This will use a chroma subsampling scheme that is compatible with all players.