Detect black bars in a file
detect_letterbox_in_fileDetects black bars (letterbox or pillarbox) baked into a video file by sampling frames, then returns the picture area, bar sizes, and scale needed to crop or fill the frame.
Instructions
Find black bars (letterbox or pillarbox) baked into a video file by sampling frames spread over the whole file (ffmpeg cropdetect). Returns source size, picture (the area without bars {width, height, x, y} in pixels), bars (bar size in pixels on each side), has_bars, picture_aspect_ratio and scale_percent_to_fill: the clip scale that makes the picture fill the frame. Use it to decide the scale (set_clip_scale) or crop (crop_clip) needed to remove the bars. Fails with FFMPEG_FAILED when every sampled frame is completely black. 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_letterbox_in_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path of the media file on this computer. | |
| samples | No | How many points spread over the file to sample (6 frames each), 1-20. Default 5. More is safer for footage with dark scenes. | |
| black_threshold | No | Luminance (0-255) up to which a pixel counts as part of a black bar. Default 24. | |
| timeout_seconds | No | Stop ffmpeg and fail with TIMEOUT after this many seconds. Default 120. |