Nodes/civitai-comfy-nodes/Civitai Video Background Removal
ComfyUI Node

Civitai Video Background Removal

Cut a subject out of a video without touching a frame

By civitai·Created 3 months ago·Updated 2 days ago· 44
Civitai Video Background Removal
  • video
  • api_config
  • video
  • workflow_id
  • raw_json
foreground_points_json
background_points_json
mask_expansion0
mask_feather2.00

Removing a background from a still image is a solved-enough problem that it's basically free. Removing it from video is a different animal - the subject moves, the background shifts, and frame-by-frame cutouts flicker. This node takes that job to Civitai's cloud: video in, subject separated, video out, with a few knobs to fix the inevitable edge problems. It's the video cousin of the background-removal story the KB tracks on the image side, and it's dramatically easier than doing it locally.

What it is

Civitai Video Background Removal from civitai/civitai-comfy-nodes, under Civitai/Video. It's a videoBackgroundRemoval recipe: your VIDEO goes up to the orchestration API, a hosted matting/segmentation model tracks the subject across frames, and the cutout comes back as a VIDEO. Native socket in, native socket out - wire a video generator or a Load Video into it and a Preview/Save Video after it, and the graph stays clean.

The inputs

  • video - required, a VIDEO socket. Anything the pack or a local loader produces.
  • foreground_points_json / background_points_json - the two fields that fix the model's guesses. These are click-point hints, JSON lists of coordinates marking what's definitely subject and what's definitely background. The image-side lesson from the KB applies here too: for hair, fur, and semi-transparency, the automatic result is usually good but not perfect - and a couple of points on the troublesome areas is the manual correction that closes the gap.
  • mask_expansion - -32 to +32, default 0. Negative shrinks the mask (trim bleeding edges), positive grows it (rescue a cut-off subject). The dial for "the edges are eating the subject" vs "the background is leaking in."
  • mask_feather - 0 to 32, default 2. Softens the mask edge so the cutout doesn't look like a sticker with a hard rim. If you see a visible fringe, feather is the first thing to bump.

The outputs

  • video - the cutout, as a native VIDEO. Wire it into Preview Video, Save Video, or a compositing step.
  • workflow_id / raw_json - the pack standard.

Installing it

ComfyUI Manager → Civitai Comfy Nodes → Install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/civitai/civitai-comfy-nodes.git
pip install -r civitai-comfy-nodes/requirements.txt

No local segmentation models - requests + python-socketio only.

Gotchas

  • Metered, and video is the expensive end. Every second of processed video costs Buzz. Preview on short clips and low resolution before committing the full-length run.
  • Your video leaves the machine. It's uploaded to Civitai's fleet for processing - fine for your own clips, a real consideration for anything sensitive or client-owned.
  • Click points are JSON, not drawn masks. If you're used to image-side point-prompting in a canvas, this is the text-JSON version. Keep the JSON valid or the call fails before it starts.
  • Credentials - Civitai Auth node, CIVITAI_API_TOKEN, or sidebar OAuth.
  • Expect some frame-to-frame variance. Video matting is harder than image matting; when a clip flickers, mask_expansion and mask_feather fix a lot of it, and click points fix the rest.
CategoryCivitai/Video

Inputs (6)

NameTypeDefaultDescription
videoVIDEO
foreground_points_jsonoptSTRING
background_points_jsonoptSTRING
mask_expansionoptINT0-32–32
mask_featheroptFLOAT2.000–32
api_configoptCIVITAI_CONFIGOptional Civitai Auth connection; defaults to CIVITAI_API_TOKEN or stored OAuth login.

Outputs (3)

NameTypeDescription
videoVIDEO
workflow_idSTRING
raw_jsonSTRING