ποΈ Detect Scenes
Find every cut in raw footage and feed the boundaries straight into a trimmer
- scene_ranges
- ranges_json
- count
MF_DetectScenes finds the shot boundaries in a video - every place the frame changes dramatically enough to be a cut - and emits them as a list of time ranges. It's the "where are the edits" node, and its natural partner is MF_TrimByRanges: split raw footage into shots for a highlight reel, or keep only the scenes you actually want.
The elegant bit is that its output plugs straight into MF_TrimByRanges with no adapter. The output type is literally named SILENCE_RANGES - a historical artifact, because it's the same list[[start, end]] contract that MF_DetectSilence uses. It's a generic ranges type wearing a misleading name; don't let the name throw you.
How it works
It runs FFmpeg's scene-detection filter - select='gt(scene,threshold)' plus showinfo - and parses the reported scores into boundaries. The threshold controls sensitivity: the scene score is how different a frame is from its predecessor, and a boundary fires when it exceeds the threshold. Lower threshold = more sensitive = flags smaller changes (zooms, fast pans) as cuts. It then merges scenes shorter than min_scene_sec into their neighbor so camera wobble doesn't over-fragment the output. Unlike MF_DetectSilence - which returns only the detected silent spans - this node always returns ranges covering the whole clip, which is what makes mode=keep in the trimmer work.
The inputs that matter
video_path- the source.threshold- default0.4(0.05β1.0). Lower = more cuts. If you're getting cuts on every pan and zoom, raise it; if it's missing hard cuts, lower it.min_scene_sec- default1.0; scenes shorter than this merge into the previous one.
Outputs: scene_ranges (SILENCE_RANGES, wire to MF_TrimByRanges.ranges), ranges_json (same data as a string, for eyeballing), and count (number of scenes after merging).
Install
Part of MediaForge:
cd ComfyUI/custom_nodes
git clone https://github.com/leon80148/comfyui_MediaForge.git
# restart ComfyUI
Or ComfyUI Manager β "MediaForge".
Common issues
Tuning is the whole game. A threshold that works on talking-head footage over-fragments a fast-cut montage, and vice versa - there's no universal setting, so start at 0.4, look at count, and move in the direction of the error. Note this is purely visual detection; it has no idea about audio, so a music video with cuts on the beat where the frame barely changes will still read as one long scene. If that's your footage, you want MF_DetectSilence for the audio side or a manual ranges_json in the trimmer. Also: it decodes the video to analyze it, so long 4K sources take a real moment - the output is just data, there's no encode cost.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| video_path | STRING | input/sample.mp4 | β |
| threshold | FLOAT | 0.400.05β1 | β |
| min_scene_sec | FLOAT | 1.00β60 | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| scene_ranges | SILENCE_RANGES | β |
| ranges_json | STRING | β |
| count | INT | β |