ffmpeg -framerate 1/5 -pattern_type glob -i "*.jpg" -c:v libx264 -r 24 -pix_fmt yuv420p output.mp4
Parameter | Description |
---|---|
-framerate 1/5 |
Sets the input frame rate (how many images per second). Here one image every 5s |
-pattern_type glob |
Uses glob pattern matching for finding files |
-i "*.jpg" |
Specifies all JPG files in the current directory as input |
-c:v libx264 |
Sets the video codec to H.264 |
-r 24 |
Standard 24 fps output (smooth playback) |
-pix_fmt yuv420p |
Sets the pixel format to YUV 4:2:0 (required for compatibility) |
ffmpeg -framerate 1/5 -i img%04d.jpg -c:v libx264 -pix_fmt yuv420p -r 24 numbered_timelapse.mp4
Works with sequentially numbered files (img0001.jpg, img0002.jpg, etc.) at 24 fps.
ffmpeg -framerate 1/3 -pattern_type glob -i "*.jpg" -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:v libx264 -r 18 -preset slow -pix_fmt yuv420p hq_timelapse.mp4
Resizes images to 1080p while maintaining aspect ratio and uses padding if needed to maintain uniform dimensions
ffmpeg -framerate 1/5 -start_number 1 -i "img_%04d.jpg" -vf "drawtext=font=Arial:text='Watermark':fontcolor=white:box=1:boxcolor=black:fontsize=48:x=10:y=10" -c:v libx264 -r 24 -pix_fmt yuv420p watermarked.mp4
Uses files named like "img_0001.jpg", "img_0002.jpg", etc. and adds a text overlay 'Watermark' in a black box
You can find the code of of this cheatsheet and more in my GitHub repository.