Nodes/ComfyUI/SAM3 Track Preview
ComfyUI Node Runs on cloud

SAM3 Track Preview

Watch what SAM3 actually tracked before you trust it

By Comfy-Org·Created 4 years ago·Updated 20 days ago· 121,575
SAM3 Track Preview
  • track_data
  • images
    opacity0.50
    fps24

    SAM3_VideoTrack hands back an opaque blob of tracking data. Before you trust that data enough to feed masks into an inpainting pass, you want to see it - and that's the entire job of this node. It turns a track into a color-coded overlay video, playing right in the ComfyUI UI, showing exactly which object the tracker followed, where it drifted, and which frames it lost. It's the "trust, but verify" node of the SAM3 family.

    Think of it as the debug view for tracking. Object 0 gets one color, object 1 another, and each mask gets its object ID drawn at its center of mass. If a mask slides off a person and onto a wall halfway through, you'll see it instantly - something a wall of mask tensors would never tell you. You run this once, confirm the track is solid, then reach for SAM3_TrackToMask to actually do the work.

    How it works

    This is a pure visualization node - it unpacks the packed per-object masks from the tracking data, layers each object's mask as a colored translucent overlay on the frame, stamps the object ID at each mask's centroid (plus the detection score underneath, for tracked objects that were text-detected mid-clip), and encodes the result as an H.264 MP4 in ComfyUI's temp directory. It marks itself as an output node, so it terminates that branch of the graph.

    The inputs and outputs that matter

    • track_data - required, straight from SAM3_VideoTrack.
    • images - optional. Connect the original frames to see the overlay on the actual video. Leave it unconnected and you get the masks rendered on a black canvas, which is genuinely useful for checking mask shape without the video distracting you.
    • opacity - how see-through the overlay is (0–1, default 0.5). Lower it if the color is hiding the subject.
    • fps - playback rate for the preview, default 24. It only affects the preview file, not the tracking.

    It has no tensor output - this is a terminal node. The object IDs you see in the overlay are exactly the indices you'll feed to SAM3_TrackToMask's object_indices field, so the flow "track → preview to learn the IDs → convert the one you want" is the natural pattern.

    The gotcha to know about

    Because it writes an MP4 to temp, the preview video you're watching is a file, not a live render - there's no way to pipe this colored overlay into the rest of your graph. People occasionally try, get confused, and waste a node. If you want the overlay as a usable image sequence, you'd have to rebuild it yourself from the masks; this node is deliberately a dead end so it can be a fast one.

    Second thing: it only renders what the tracker found. Track four objects and three of them vanish from the video after frame 20, that's the tracker honestly reporting its misses - which is precisely the information you need to decide whether to re-track with a better seed mask or a lower detection_threshold upstream. The preview isn't where tracking problems get fixed; it's where they get found.

    Categoryimage/detection

    Inputs (4)

    NameTypeDefaultDescription
    track_dataSAM3_TRACK_DATA
    opacityFLOAT0.500–1
    fpsFLOAT241–120
    imagesoptIMAGE

    Outputs (0)

    No outputs