Detect scene changes in a file
detect_scene_changes_in_fileDetect abrupt scene cuts in a video file and return each cut's time and ffmpeg scene score, so you can split a flattened export into shots or place markers at edits.
Instructions
Find the cuts in a video file: the times where the picture changes abruptly (ffmpeg scene score). Returns cuts as {time, score}: time in file time (seconds from the start of the file) of the first frame of the new shot, score 0-1. Use it to split a flattened export back into shots (razor_at_times (for a clip at 100 % speed: sequence time = clip start + file time - clip in point)) or to place markers at every cut (add_markers). Dissolves and fades are usually not detected. detect_scene_edits does the same inside Premiere on timeline clips. Works on the file on disk with ffmpeg, not on the timeline; Premiere Pro is not needed. ffmpeg and ffprobe must be installed (see check_ffmpeg), else FFMPEG_NOT_FOUND.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"path": "<path>"
},
"name": "detect_scene_changes_in_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| end | No | Analyse up to this file time, in seconds; clamped to the file's length. Must be greater than start. Default: the end of the file. | |
| path | Yes | Absolute path of the media file on this computer. | |
| start | No | Analyse from this file time (seconds from the start of the file). Default 0. | |
| threshold | No | Scene score (0-1) a frame must exceed to count as a cut. Default 0.3. Lower finds more cuts (0.1-0.2 for subtle ones), higher fewer. | |
| max_results | No | Maximum cuts to return. When there are more, the result has truncated=true and the total count. Default 1000. | |
| min_spacing | No | Ignore a cut closer than this many seconds to the previous one (flashes, strobes). Default 0.25. | |
| timeout_seconds | No | Stop ffmpeg and fail with TIMEOUT after this many seconds. Default 600. |