Detecting videos mask
Find the continuous segments in a tracked video
- images
- bboxes
- segments_data
- segment_bboxes
- segment_count
If you're running a detector across a video sequence - tracking a face, a subject, whatever a bounding box can find - you often want to know when it's actually there continuously, not just which individual frames have a hit. Detecting_videos_mask does exactly that: it looks at bounding-box data frame-by-frame and works out which stretches form a stable, continuous segment, filters out anything too short to bother with, and hands the result off to Cutting_video for the actual extraction.
Both nodes live in ComfyUI-WJNodes, a big personal utility pack from a GitHub author going by 807502278 - the same repo that also does mask cropping, color filtering, and file operations. The README frames it plainly: "a simple node package that I use myself," not a polished flagship tool.
How it works
For each frame, the node compares the current bounding box to its neighbors and decides whether the tracked object is moving continuously (part of the same segment) or has jumped, disappeared, or reappeared somewhere else (a break between segments). distance_threshold sets how much a box can shift between frames before it's treated as a discontinuity. Once segment boundaries are worked out, anything shorter than min_segment_length frames gets dropped as noise rather than kept as a real segment. If a frame has multiple candidate detections, use_highest_confidence decides whether to trust the strongest one or treat the ambiguity as a reason to skip.
The inputs and outputs that matter
images- the full frame sequence you're analyzing.bboxes(optional) - the per-frame bounding-box data driving the continuity check. This is a required concept, even though the input slot is technically optional - without it, there's nothing to base segment detection on. It comes from a detector node upstream (this pack's own YOLO helpers, or another detector elsewhere in your graph).min_segment_length(default 5) - the shortest run of frames that counts as a real segment. Raise this if you're getting a lot of tiny, spurious segments.distance_threshold(default 0.5, range 0.1–1) - how much box position can change between adjacent frames before it counts as a break in continuity. Lower it to be stricter about what counts as "continuous."use_highest_confidence(default on) - pick the strongest detection when a frame has more than one candidate box.
Outputs: segments_data (feeds straight into Cutting_video), segment_bboxes (a list of the bounding boxes per segment), and segment_count (how many valid segments it found - handy for a quick sanity check before you go further).
How to install it
Via ComfyUI Manager, search "ComfyUI-WJNodes." Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/807502278/ComfyUI-WJNodes.git
Restart ComfyUI. No models to download - this node works purely on bounding-box coordinates, not pixels. If you're feeding it boxes from this pack's own YOLO detection helpers, those specific helper nodes need Impact Pack installed alongside WJNodes, even though Detecting_videos_mask itself doesn't.
Common issues & troubleshooting
segment_count comes back 0. Usually means distance_threshold is too strict for how much your tracked subject actually moves, or min_segment_length is filtering out everything you've got. Loosen one or the other and check segment_bboxes to see what the raw detections looked like before filtering.
Segments feel too fragmented - lots of short breaks that should be one continuous stretch. Raise distance_threshold so small frame-to-frame jitter in the bounding box doesn't get read as a discontinuity.
No bboxes connected, and results look meaningless. This node needs real bounding-box data to find anything - without it there's no continuity signal to work from.
No community track record for this specific node. It's a bespoke piece of a personal pack rather than a well-trodden tool, so there's no forum thread to lean on if a setting behaves surprisingly - test on a short clip with a known, obvious segment before trusting it on a longer one.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | — | |
| min_segment_length | INT | 51–1000 | — |
| use_highest_confidence | BOOLEAN | true | — |
| distance_threshold | FLOAT | 0.500.1–1 | — |
| bboxesopt | bboxs | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| segments_data | segments_data | — |
| segment_bboxes | LIST | — |
| segment_count | INT | — |