SAM3 - Video Masking via Text Prompts
SAM 3 lets you mask objects in a video just by typing a short phrase like "red car" or "person" — no frame-by-frame rotoscoping. It finds every matching instance, tracks them across frames with stable IDs, and outputs per-frame masks ready for compositing, blurring, or replacement.
About
This workflow demonstrates text-driven video masking with the SAM3 Video Masking node (ID: 9cea40bb-b0cf-4b40-a758-8935cfe8d52f). You load a clip with VHS_LoadVideo, describe the target in plain language (for example, "red car", "person", "coffee cup"), and the node finds every matching instance and tracks them across frames with stable IDs. It produces three parallel outputs: a preview overlay (colored masks drawn over the original frames), a raw binary/gray mask stream, and a cut-out stream where only the masked pixels are kept.
What you provide
- Reading the workflow
Runs in ComfyUI. This workflow can't run on this page. Open it in Comfy Cloud with everything loaded, or download it for your own ComfyUI.
Try in CloudQuestions & answers
Connect each SAM3 output to its own SaveVideo node. Use VHS_LoadVideo’s fps output to drive the SaveVideo fps input (or set it manually), pick a file path and format, and render. You can export any or all of the streams independently.
Yes. If the prompt matches multiple instances (e.g., "person"), the node will segment and track each with stable IDs. To limit results, make the prompt more specific (e.g., "person in red jacket") or crop the input to the region of interest.
Rapid motion, motion blur, or heavy occlusion can reduce per-frame confidence and disrupt tracking. Improve results by using a more specific prompt, increasing the node’s confidence/score thresholds, and processing the original-resolution video (or less downscaling) if VRAM allows.
A GPU is strongly recommended. Performance scales with VRAM and compute capability. You can still prototype on limited hardware by lowering resolution and using VHS_LoadVideo’s frame_load_cap to preview a short segment before running the full clip.