Skip to main content

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.

By Published Updated

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.jpg

Swap 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.jpg

Extract 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.png

Extract 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.jpg

Control 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.jpg

Prefer 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.

FAQ

Frequently asked questions

What is the fastest FFmpeg command for one frame?
Put -ss before -i, then use -frames:v 1. Seeking before input is much faster on long files than decoding from the start. Example: ffmpeg -ss 00:01:23 -i input.mp4 -frames:v 1 frame.jpg
How do I extract 1 frame per second with FFmpeg?
Use the fps filter: ffmpeg -i input.mp4 -vf fps=1 frames/out_%04d.jpg. For one frame every 5 seconds use fps=1/5. Create the output folder first.
Should I use JPG or PNG with FFmpeg?
JPG with -q:v 2 is a strong default for previews and datasets that tolerate light compression. PNG is better for lossless labeling and repeated re-encodes. Pick based on storage vs fidelity.