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.
Technically, the node performs text-conditional object detection and segmentation per frame, then links detections across time to keep IDs stable. VHS_LoadVideo supplies the frame sequence and fps; SaveVideo writes each output stream to disk. For quick iteration, the frame_load_cap parameter on VHS_LoadVideo lets you limit how many frames are processed; set it back to 0 for a full run. A MarkdownNote node in the graph provides inline reminders for prompt writing and testing.
API
Use this workflow from code
Every Comfy workflow is a JSON graph. The payload below is this workflow, exactly as ComfyUI runs it — fetch it from the URL, keep it in version control, or load it in ComfyUI and run it node by node.
Run it from TypeScript or Python with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
// Install (beta)
npm i @comfyorg/sdk
// Run this workflow (TypeScript)
import { Comfy } from "@comfyorg/sdk";
const client = new Comfy({ apiKey: "comfyui-..." });
const wf = await client.workflows.fromFile("workflow_api.json");
const job = await client.run(wf);
await job.getOutputs("<output-node-id>")[0].toFile("output.png");The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API).
Comfy Cloud API access requires a plan with an API key.
FAQ














