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.
GET https://comfy.org/workflows/download/8f2cf0df5da6.jsonFetching workflow JSON…
Run it from Python or TypeScript with the Comfy SDK. The same code targets Comfy Cloud or a ComfyUI you host yourself — only the base URL changes.
# Install (beta)
pip install comfy-sdk # Python
npm i @comfyorg/sdk # TypeScript
# Run this workflow (Python)
from comfy_sdk import Comfy
client = Comfy(api_key="comfyui-...")
wf = client.workflows.from_file("workflow_api.json")
job = client.run(wf)
for output in job.get_outputs("<output-node-id>"):
output.to_file(output.name)The SDK takes a workflow in API format: open this workflow in ComfyUI and use File → Export Workflow (API). API access requires a Comfy Cloud plan with an API key. SDK docs · Get an API key
FAQ














