Run SAM3 Video Track
Follow one object through every frame of a video
- images
- model
- initial_mask
- conditioning
- track_data
This is the node that turns "cut the runner out of this clip and swap the background" from a frame-by-frame nightmare into a two-node graph. Mark the runner once on frame one, run this, and SAM3's tracker carries a mask through every frame while you go make tea. It's the most impressive detection node ComfyUI core ships, and - surprise - it's also the one people actually search for.
SAM3 is Meta's late-2025 model, and the core implementation landed in ComfyUI in April 2026. Where the classic SAM needed a click or box on every image, SAM3 keeps a memory of what it's tracking and propagates it across time. Give it a batch of video frames and it maintains object identities frame to frame, so a mask you draw on frame 0 stays glued to the same person through occlusions, camera moves and scene changes.
How it works
Under the hood this calls SAM3's forward_video: a memory encoder builds an appearance memory from frames it has seen, memory attention matches the tracked objects against what's on screen now, and the SAM mask decoder refines each candidate mask. It re-detects objects every detect_interval frames using the text prompts you fed in, and re-grips anything that drifted. The one thing it cannot invent is the subject - which is why you must give it either an initial_mask or text conditioning. Give it neither and it raises an error on purpose.
The inputs and outputs that matter
- images - your video frames as a batched IMAGE (same thing a
Load Video-style node outputs). - model - the SAM3 checkpoint. Drop
sam3.1_multiplex_fp16.safetensorsinmodels/checkpoints/and load it with a checkpoint loader; wire the MODEL output here. - initial_mask - one mask per object, for the first frame. This is the hands-on path: paint it, or get it from
SAM3_Detect. - conditioning - CLIPTextEncode output ("person", "car"). Used to seed tracking and to detect new objects mid-clip.
- max_objects - cap on tracked objects. Note the trap: initial masks count toward this limit.
0means "use the internal cap of 64". - detect_interval - run text detection every N frames.
1= every frame, which is the most accurate and the slowest; bump it up when frames are near-identical.
The single output, track_data (SAM3_TRACK_DATA), doesn't render anything on its own. Wire it to SAM3_TrackPreview to watch the colored overlay video, or to SAM3_TrackToMask to pull real masks out and feed inpainting or compositing.
Where people get burned
VRAM. This is the real, recurring complaint in the community: SAM3 is the kind of model that leaves about 1.8GB sitting in VRAM even after you unload it, and on a 12GB card that extra residency is enough to OOM the next model you load. People report the standard "clean VRAM" nodes doing nothing about it, with the only reliable fix being a fresh workflow or a ComfyUI restart. Budget for it: run tracking as its own step, then generate after, rather than chaining the whole thing in one pass.
Also don't expect perfection from a single sloppy seed mask. The tracker is good, but a mask that grabs the background or two people at once gives it a mess to lock onto. Spend the extra thirty seconds making the initial mask clean - it's the difference between "cut the runner out" and "cut half the stadium out".
If you only need one still image segmented, skip the tracker entirely and use SAM3_Detect. Video tracking is what this node exists for.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| images | IMAGE | Video frames as batched images | |
| model | MODEL | — | |
| detection_threshold | FLOAT | 0.500–1 | Score threshold for text-prompted detection. |
| max_objects | INT | 40–64 | Max tracked objects. Initial masks count toward this limit. 0 uses the internal cap of 64. |
| detect_interval | INT | 1 | Run detection every N frames (1=every frame). Higher values save compute. |
| initial_maskopt | MASK | Mask(s) for the first frame to track (one per object) | |
| conditioningopt | CONDITIONING | Text conditioning for detecting new objects during tracking |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| track_data | SAM3_TRACK_DATA | — |