Find the cuts in a video with ffmpeg's scene filter
One ffmpeg command that lists the timestamps where the picture changes, how to set the threshold, and why phone footage often has no cuts to find.
# prints one pts_time per detected cut, in seconds
ffmpeg -hide_banner -i {input.mp4} -vf "select='gt(scene,0.3)',showinfo" -an -f null - 2>&1 | grep -o "pts_time:[0-9.]*" In Claude Code, paste the prompt as a message.
Steps
- Run it on an already edited video, or on a clip you suspect has several shots. Each line is the time in seconds of the first frame of a new shot.
- Start at 0.3. Too many hits from camera flashes or fast pans: raise it to 0.4 or 0.5. Missed cuts, above all fades and dissolves: lower it to 0.2 or 0.1.
- Check every hit by eye: open the video at that time, or grab the frames around it with ffmpeg -ss {seconds} -i {input.mp4} -frames:v 1 frame.png.
- For a folder of phone clips, skip detection inside each file. A phone clip is usually one continuous shot, so the clip boundaries are your shots.
Example
On a test file made of three flat colour blocks of 3 seconds each (red, blue, green), the command printed pts_time:3 and pts_time:6, both with a scene score of 0.4. A real film gives more hits than cuts at 0.3; the by-eye check in step 3 is part of the method.
Tips
- The score is a frame-to-frame difference from 0 to 1, so a hard cut is exact to the frame. A slow dissolve changes little per frame and scores low on each one.
- On your own phone footage expect few or no hits. It is shot in long takes, and a detector that returns nothing there is correct, not broken.
- Want it without a terminal and without an upload? The scene detector at life2film.com/tools runs in a browser tab.
- Cut times are the input for the cutaway rules: keep b-roll inside one shot, and never cover a shot where lips move.
Read more
- Scene detector (runs in the browser) · life2film.comDrop in a video, get the cut points. Nothing is uploaded.
- life2film-engine on npm · npmThe analysis core as WebAssembly: beats, downbeats, shot boundaries, frame scores. Free for noncommercial use.
- A cut detector found zero cuts in a day at the beach · rustman.orgSixteen classical detectors and two learned models on hand-labelled phone footage: why a day of phone video has few cuts to find.
| works with | ffmpeg: A terminal command you run yourself. · Claude Code: Runs as a skill or a prompt in the terminal; can read your files and write the result. · By hand: No tool needed: a checklist or a technique. |
| cost | Free. No API, no key. |
| status | Unverified: written from the technique, not yet run end to end by us. |
| source | ffmpeg-filters: the select filter and its scene variable |
| license | CC BY 4.0 for the text here; skills are MIT. |
| updated | 2026-11-10 |
| for agents | find-cuts-in-a-video-with-ffmpeg-scene-filter.md |
Related
Scenes, not best phrases: keep the lead-in, the talk and the reaction
Why a reel of good lines confuses everyone who was not there, and the checklist for keeping a scene whole: the lead-in, the talk, the reaction, with filler trimmed only at the ends.
The cutaway rule: what is said, same place and time, never over moving lips
Three constraints for every cutaway in a talking film, and the agent prompt that applies them to a transcript. Kills what viewers read as broken: a picture from elsewhere, a face out of sync.
Analyse once: sidecar files beside the sources, shooting time from the container
The storage rule that makes a long film possible a month later: each clip's shots, frame scores, beats and speech live in a file beside it, and shooting time comes from the container metadata.
A contact sheet of every cutaway with its line under it
The one-page check that catches off-topic cutaways before anyone watches: every cutaway frame in a grid, its sentence under it. Measured once: 12 of 54 automatic cutaways were off topic.
Voice as one continuous track, pictures on top, and the one-frame length check
The assembly rule for talking films: cut the audio from the same pieces as the picture, snapped to frames, then verify film length equals voice length. Drift over one frame is a bug, not a quirk.
Beat times and downbeats from a song in Node, with life2film-engine
A short Node script that decodes a song with ffmpeg and prints BPM, beat times and downbeats on your machine, ready to place cuts on. No upload, no API key.