What You’ll Learn
- How to detect scene changes with the
scdetfilter - How to tune detection sensitivity via
threshold(t) - How to read per-scene timestamps from the filter metadata
- How to extract a frame at each scene boundary using
select - How to batch-generate thumbnails at every cut
Tested with: FFmpeg 6.1 (ubuntu-latest / CI verified)
Platform: Windows / macOS / Linux
Basic Command
ffmpeg -i input.mp4 -vf "scdet=t=10" -f null /dev/null
-f null /dev/null skips writing an output file and prints detection info to stderr.
Reading the Output
[scdet @ 0x...] lavfi.scd.score: 18.3, lavfi.scd.time: 4.96
[scdet @ 0x...] lavfi.scd.score: 32.7, lavfi.scd.time: 23.42
| Field | Description |
|---|---|
lavfi.scd.score | Scene-change score (higher = larger change) |
lavfi.scd.time | Timestamp of the detection (seconds) |
Tuning threshold
| Parameter | Default | Description |
|---|---|---|
t / threshold | 10 | Scores at or above this value are reported as scene changes |
ffmpeg -i input.mp4 -vf "scdet=t=20" -f null /dev/null
- Low value (e.g. 5): Detects small changes (more false positives)
- High value (e.g. 40): Detects only clear cuts (more missed cuts)
- Documentaries and films:
10–20is a reasonable starting point
Save a Frame at Every Scene Change
Combine with the select filter to save a still at each cut.
ffmpeg -i input.mp4 -vf "scdet=t=10,select=gt(scene\,0.1)" -vsync vfr scene_%04d.png
Note: The
scenemetadata read byselectis thescdetscore normalized to 0–1.gt(scene\,0.1)selects frames whose score exceeds 10%.
Print Timestamps via showinfo
ffmpeg -i input.mp4 -vf "scdet=t=10,metadata=print:key=lavfi.scd.score" -f null /dev/null
Threshold Suggestions by Content Type
| Use case | Recommended threshold |
|---|---|
| Film cut detection | 8–15 |
| Sports footage | 15–25 |
| Animation | 10–20 |
| Surveillance footage | 5–10 |
| Slideshow-style videos | 30–50 |
Caveats
Fades and Dissolves Are Hard to Detect
Hard cuts (instant transitions) are detected reliably, but fades and dissolves (gradual transitions) can trip up scdet and cause misdetection.
Long Videos Take Time
Scene detection decodes every frame, so long videos take a while to analyze. You can narrow the analysis with -ss and -to.
Frequently Asked Questions
What threshold should I use for scene detection?
gt(scene,0.4) flags significant cuts. Lower to 0.3 for fast-cut content, raise to 0.5 to catch only hard cuts and ignore camera moves.
How do I export the timestamps to a file?
ffmpeg -i in.mp4 -filter:v "select='gt(scene,0.4)',showinfo" -f null - 2> scenes.log then grep for pts_time.
Why does scene detect miss obvious cuts?
Cross-fades and flash-cuts can hide under the threshold. Combine scene detection with blackdetect to catch fade-outs that act as cuts.
Can I split the video at every detected scene automatically?
Yes — feed the timestamps into a wrapper script that calls ffmpeg -ss A -to B -c copy partN.mp4 per detected range.
Does scene detect work on animation?
Yes but tune the threshold. Animation has flatter colour distributions, so lower the threshold to 0.25–0.3 to catch real cuts.
Related Articles
- Detect Black Frames — Find Scene Boundaries with blackdetect
- Extract Thumbnails — Pull a Single Frame as an Image
Tested with ffmpeg 6.1 / Ubuntu 24.04 (GitHub Actions runner) Primary sources: ffmpeg.org/ffmpeg-filters.html#scdet / ffmpeg.org/ffmpeg-filters.html#select