Ffmpeg
Convert Each Video Frame to Individual Photo

How to convert a video to images through the cli

The following command converts a video to individual images using ffmpeg:

ffmpeg -i a.mp4 -vf "fps=10" -q:v 1 image_%04d.jpg
  • -i a.mp4: This argument specifies the input file, in this case, a.mp4. It tells ffmpeg which video file to process.
  • -vf "fps=10": This argument specifies a video filter to apply during the conversion. In this case, the filter is fps=10, which stands for frames per second. It sets the output frame rate to 10 frames per second. This means that for every second of the video, ffmpeg will extract 10 frames.
  • -q:v 1: This argument sets the video quality. The q:v option stands for video quality, and 1 is the value assigned to it. A lower value indicates higher quality. In this case, 1 represents a high-quality output.
  • image_%04d.jpg: This argument specifies the output file pattern. It tells ffmpeg how to name the individual photo frames. The %04d is a placeholder that will be replaced with a sequential number for each frame. The frames will be saved as JPEG images with the extension .jpg.

So, when you run this command, ffmpeg will take the input video file a.mp4, extract frames at a rate of 10 frames per second, set the video quality to 1 (high quality), and save each frame as a separate JPEG image with a sequential number in the file name.