Black Frame Detector
Find the black frames your editor pretended weren't there
- video
- black_ranges_json
- range_count
- summary
Every AI video pipeline eventually produces a clip that starts black, ends black, or hiccups into darkness for a few frames. MKRBlackFrameDetector is the node that finds those frames and hands you their exact time ranges as JSON - which you can then feed into trimming, chapter markers, or the pack's EDL export. It's an analysis node, not a fixer: it tells you where, you decide what to do about it.
It comes from MKRShift_Nodes, criskb's broad media-and-direction pack. Install via ComfyUI Manager (search "MKRShift_Nodes") or git clone https://github.com/criskb/MKRShift_Nodes into custom_nodes/, restart, and it's under MKRShift Nodes → Media → Analysis. No extra Python deps, no models to download.
How it works
Mechanically it's refreshingly honest. It decodes the video into frames, computes the mean luma (brightness) of each frame, and flags any frame whose luma is at or below luma_threshold. Then it groups the flagged frames into contiguous runs and keeps only runs at least min_run_frames long - so a single dropped frame or a flash doesn't count. Each run becomes a range with start and end times in seconds, derived using the video's real FPS (or fallback_fps if that can't be read).
The three knobs
luma_threshold(default 0.03) - a 0-to-1 brightness cutoff. 0.03 is genuinely near-black. If your "black" clips are actually dark gray, nudge it up.min_run_frames(default 3) - the minimum length of a black run to report. Raise it to ignore blink-length dips, lower it to catch even single-frame issues.fallback_fps(default 24) - only used when the frame rate can't be read from the source.
Outputs: black_ranges_json (the ranges), range_count, and a summary JSON with frame count and black-frame count.
Gotchas worth knowing
The threshold applies to the mean luma of the whole frame. A frame that's mostly black but has a bright watermark or logo won't trigger, and a dim-but-visible frame might. If you need per-region detection, this isn't the node. And remember it decodes every frame - long 4K clips take a while. For a quick sanity check, wire the output into a text viewer and eyeball the ranges before you trust them for an automated trim. The node is small, no-frills, and does exactly what it says on the tin, which is more than you can say for half the pack.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| video | * | — | |
| luma_threshold | FLOAT | 0.0300–1 | — |
| min_run_frames | INT | 31–100000 | — |
| fallback_fps | FLOAT | 24.01–240 | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| black_ranges_json | STRING | — |
| range_count | INT | — |
| summary | STRING | — |