FFmpeg: Set Input Frame Rate of Image Sequence

When converting a series of sequential images into a video using FFmpeg, defining the correct input frame rate is crucial to ensure the output video plays at your intended speed. This guide provides a direct, step-by-step explanation of how to use the -framerate option to specify the input frame rate for an image sequence, preventing issues like skipped frames or incorrect playback speeds.

The Correct Command Structure

To set the frame rate of an input image sequence, you must place the -framerate option before the input flag (-i).

Here is the basic command:

ffmpeg -framerate <fps> -i input_%04d.png output.mp4

Step-by-Step Example

If you have a sequence of images named frame_0001.png, frame_0002.png, etc., and you want to combine them into a video at 30 frames per second (FPS), run the following command:

ffmpeg -framerate 30 -i frame_%04d.png output.mp4

Key Components Explained

Crucial Tip: Input vs. Output Frame Rate

It is a common mistake to place the frame rate option after the input file, or to use the -r flag instead of -framerate.

ffmpeg -framerate 10 -i frame_%04d.png -r 30 output.mp4

This command reads the images at 10 FPS but duplicates the frames smoothly to create a standard 30 FPS video file.