Follow a named subject with SAM3 (boxes and mask per frame)
Finds and follows what subject.text names in a cut clip with core ComfyUI SAM3: the video tracker writes the subject's mask as a video (white = the subject) and per-frame detection writes a JSON list of boxes with scores, for an edit reframe crop that follows a product, a dancer or an athlete.
Discover · Wavemaker catalog
When to use it
- A vertical cut of a moving subject that is not a talking head (watch speakers covers those).
- Boxes for a crop path, a mask for a cutout or a regional edit.
What you provide
- clip.file: the cut clip (never a long source).
- subject.text: what to follow, e.g. "the woman in the red jacket".
- window.batch_index / window.length: the frames to read (default the first 240, up to 4096).
What you get
- save_boxes: JSON, per frame a list of {x, y, width, height, score} in source pixels, best first.
- save_mask: the tracked subject's mask as a video at the source fps.
Setup and requirements
- The graph needs its listed Comfy nodes, selected models and any connected provider access. Replace example prompts and source files with your own.
Things to know
- Needs the sam3.1 checkpoint on the runtime; GPU time grows with frames, so keep clips short.
- Detection lists every match per frame; pick the box nearest the previous one when two things match.
- Boxes become edit reframe anchors with t = frame / fps and x = (x + width / 2) / source width.
Example brief
Follow the skateboarder through this 8 s clip and give me the boxes for a 9:16 crop.
Source licenses and model terms continue to apply. Check runtime availability before generation.
Download source · Learn how to reuse resources