📚Cheatsheets

Cheatsheet collection for go, rust, python, shell and javascript.

Convert list of images to video with FFMPEG

FFmpeg is a powerful command-line tool that can be used to merge photos into a video. The basic syntax for using FFmpeg to merge photos into a video is as follows:

ffmpeg -framerate <framerate> -i <input_pattern> -c:v libx264 -r 30 -pix_fmt yuv420p <output_file>
  • <framerate>: This option specifies the number of frames per second in the output video.
  • <input_pattern>: This option specifies the pattern used to match the input files. For example, if your photos are named "image001.jpg", "image_002.jpg", etc., the input pattern would be "image%03d.jpg".
  • -c:v libx264: This option specifies the video codec to use. In this case, it's H.264.
  • -r 30: This option specifies the framerate of the output video.
  • -pix_fmt yuv420p: This option specifies the pixel format of the output video.
  • <output_file>: This option specifies the name of the output file.

Here is a complete example that merges a series of photos into a 30 FPS video:

ffmpeg -framerate 30 -i output/project/%06d.png -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4