Create FFmpeg Time-Lapse Video with Specific FPS

This guide provides a straightforward walkthrough on how to compile a sequence of images into a high-quality time-lapse video using FFmpeg. You will learn the exact command-line arguments needed to control both the speed at which your source images are read (input frame rate) and the final playback frame rate (output FPS) of the video file.

The Standard Time-Lapse Command

If your images are sequentially named (e.g., img_0001.jpg, img_0002.jpg, etc.), you can merge them into a video with a specific frame rate using the following command:

ffmpeg -framerate 30 -i img_%04d.jpg -c:v libx264 -pix_fmt yuv420p output.mp4

Parameter Breakdown


Adjusting Input vs. Output FPS

Sometimes you want to process a low number of images per second (e.g., 5 frames per second) but want the actual output video container to run at a standard smooth rate (e.g., 29.97 or 30 FPS) to prevent compatibility issues on certain players.

To achieve this, use the -framerate option for the input and the -r option for the output:

ffmpeg -framerate 5 -i img_%04d.jpg -r 30 -c:v libx264 -pix_fmt yuv420p output.mp4

Using Wildcards (For Non-Sequential Filenames)

If your images are not sequentially numbered (for example, if they have timestamped filenames) and you are using a Unix-based system (Linux/macOS), you can use the glob pattern type:

ffmpeg -framerate 24 -pattern_type glob -i '*.jpg' -c:v libx264 -pix_fmt yuv420p output.mp4