This ComfyUI workflow builds a clean background plate by removing an object from video using SAM3-driven masks and a mask-conditioned LTX-2.3 In‑Outpainting IC‑LoRA. The pipeline loads your clip with VHS_LoadVideo/VHS_VideoInfo, extracts frames via GetVideoComponents, and uses LoadSAM3Model → SAM3VideoSegmentation to seed a mask for the object you want to remove. SAM3Propagate tracks that mask across the shot, and SAM3VideoOutput provides a per‑frame OBJECT_MASK. To ensure seamless fills, LTXVDilateVideoMask expands the mask (e.g., s10/t1) and GrowMaskWithBlur feathers the edges.
The masked region is then green‑filled by LTXVInpaintPreprocess, and CreateVideo re‑encodes those preprocessed frames. That green plate, together with the OBJECT_MASK and your minimal background‑only prompt, feeds the LTX 2.3 In‑Outpainting IC‑LoRA (packaged here as a subgraph node), which is explicitly mask‑conditioned to generate only inside the masked area. Utility nodes like VHS_GetImageCount, ComfyMathExpression, and GetImageRangeFromBatch let you preview limited frame ranges before a full run. Finally, SaveVideo writes the cleanplate result for downstream compositing.
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














