
FFmpeg: 3 Easiest Ways to Extract Frames From Video
Updated
3 easy ways to extract frames from a video using FFmpeg.

1st Method: Specific Timestamp
Let's extract a single frame at a specific timestamp. If you need a thumbnail or a snapshot taken at five seconds into your video, run this command:
ffmpeg -ss 00:00:05 -i input.mp4 -frames:v 1 output.png
The -ss flag sets the exact timestamp, -i selects your video, -frames:v 1 tells FFmpeg to extract just one frame, and output.png saves it as an image.
2nd Method: Time Intervals
Extracting frames at regular time intervals. This is ideal when you want consistent preview images throughout your clip.
To grab one frame every second, use the fps filter like this:
ffmpeg -i input.mp4 -vf "fps=1" frame_%04d.png
The frame_%04d.png part automatically numbers your output files with four digits, creating frame_0001.png, frame_0002.png, and so on.
If you prefer a frame every 5 seconds, change the filter to fps=1/5:
ffmpeg -i input.mp4 -vf "fps=1/5" frame_%04d.png
And for longer videos where you only need a frame every 60 seconds, use fps=1/60:
ffmpeg -i input.mp4 -vf "fps=1/60" frame_%04d.png
3rd Method: Every Single Frame
This method extracts every single frame from the video. Because videos run at twenty-four frames per second or higher, this action can take a few moments to finish loading and will generate a large number of images in your directory.
To dump every frame, run:
ffmpeg -i input.mp4 frame_%04d.png
Once the terminal finishes processing, open your project folder to quickly verify that your image files are there and open cleanly.
As a practical tip, if you need to save storage space when generating hundreds of frames, simply change .png to .jpg at the end of any of these commands for much smaller file sizes.
Feel free to leave a comment down below.
