Guide · CLI · 2026
How to Extract Frames from Video with FFmpeg (Complete Guide)
FFmpeg can pull a single still, sample every N seconds, dump all frames, or keep keyframes only. Below are tested commands you can paste into a terminal — then a note on when a browser tool is faster.
Extract a single frame at a timestamp
Place -ss before -i so FFmpeg seeks first, then write exactly one video frame. This is the fastest pattern on long files.
ffmpeg -ss 00:01:23.000 -i input.mp4 -frames:v 1 frame.jpgSwap the timestamp as needed. For PNG, change the output name to frame.png.
Extract one frame every N seconds
Use the fps filter. fps=1 means one frame per second; fps=1/5 means one frame every five seconds.
mkdir -p frames
ffmpeg -i input.mp4 -vf fps=1 frames/out_%04d.jpg
# one frame every 5 seconds
ffmpeg -i input.mp4 -vf fps=1/5 frames/out_%04d.jpgExtract all frames
Omitting an fps filter writes every decoded frame. A 10-minute 30 fps clip can produce ~18,000 images — plan disk space first.
mkdir -p all_frames
ffmpeg -i input.mp4 all_frames/frame_%06d.pngExtract keyframes only
Keep I-frames with a select filter and variable frame rate output so duplicates are not invented between keyframes.
mkdir -p keyframes
ffmpeg -i input.mp4 -vf "select='eq(pict_type\,I)'" -vsync vfr keyframes/k_%04d.jpgControl JPG quality with -q:v
For MJPEG/JPG outputs, -q:v 2 is a high-quality default (scale roughly 2–5 for visually excellent stills; higher numbers are smaller/lower quality).
ffmpeg -ss 00:00:10 -i input.mp4 -frames:v 1 -q:v 2 still.jpgPrefer PNG when labels or repeated edits cannot afford generation loss. Prefer JPG when you need thousands of preview frames.
When a browser tool is faster
FFmpeg wins for scripts, servers, and hundred-file batches. A browser extractor wins when you need to see the timeline, try three thumbnail candidates, and download a ZIP without installing anything. For that path, open the free GetVideoFrames extractor — local, with no video upload. Browser and device limits apply. ML teams can also start on the dataset sampling tool.