Nodes/ComfyTV/Chroma Key
ComfyUI Node

Chroma Key

Green screen removal that also handles the spill

By jtydhr88·Created 3 months ago·Updated about 15 hours ago· 725
Chroma Key
  • video
  • video
force_run_token0
project_id
parent_output_id0
key_color#00FF00
similarity0.10
blend0.05
despill_mix0.50
despill_expand0.00
outputalpha

Chroma key is how you put a subject shot in front of a green screen onto literally anything else. It's the oldest trick in the video playbook, and it's a genuinely useful node to have in your generation pipeline - you can key a subject out of an AI-generated green-screen clip and drop them onto an AI-generated background, all without leaving ComfyUI.

This is a ComfyTV VideoFX stage. It takes the keyed clip and produces a matte, and it's part of the pack's fuller keying suite - there's a whole bench with PIK, Keyer, Despill, and matte tools - but Chroma Key is the one you start with when the shot is cooperative.

The inputs that matter

  • key_color (default #00FF00) - the color you're keying out. Green is the default; pick whatever the screen actually was.
  • similarity (default 0.1, 0.01–1) - how close a pixel has to be to the key color to become transparent. Too low leaves green fringes, too high eats the subject's edges.
  • blend (default 0.05, 0–1) - softness at the matte edge. A little blend hides jagged edges; a lot makes hair and motion look mushy.
  • despill_mix (default 0.5) and despill_expand (default 0) - the despill stage removes green light bouncing onto the subject (that greenish glow on shoulders and hair). despill_mix is how hard to remove it; despill_expand widens the region where despill applies.
  • output - alpha (default) or matte. Alpha gives you the transparent composite; matte gives you the black-and-white matte itself, which is what you want if you're going to inspect or refine the key.

The project_id / parent_output_id / force_run_token inputs are internal frontend plumbing - ignore them.

How it works

It runs a chroma-key operation over the clip, converting the key color into an alpha channel, then applying the despill pass to scrub the spill from the surviving pixels. The two output modes exist because keying is iterative: you check the matte to see where it's leaking, adjust similarity/blend, and only then use the alpha for compositing.

Install

ComfyTV ships ~190 stages in one pack, so installing the pack installs this node too.

cd ComfyUI/custom_nodes
git clone https://github.com/jtydhr88/ComfyTV

Restart ComfyUI fully (the README is explicit: not a browser refresh) and find it under ComfyTV → VideoFX. ComfyUI Manager finds it by searching "ComfyTV". No model downloads and zero extra Python dependencies - chroma key is deterministic pixel math. On ComfyUI Desktop or macOS, clone into the running instance's absolute path from the startup log rather than trusting the relative cd.

Troubleshooting

  • Green fringes on the subject. Raise similarity a bit, then lean on despill_mix - the fringe is usually spill, not missed key.
  • Holes in the subject. similarity is too aggressive; back it off. You'd rather have a fringe you can despill than a hole you can't.
  • Hairy/transparent edges. This is where chroma key stops being easy. Check the matte output, and consider the pack's heavier keyers (PIK, Keyer) for hair and motion blur.

For clean green screens with a patient subject, this node just works. The moment the footage fights back, that's when the full keying bench earns its keep.

CategoryComfyTV/VideoFX

Inputs (10)

NameTypeDefaultDescription
force_run_tokenINT00–2147483647Internal — bumped on Run to invalidate ComfyUI's input cache.
project_idSTRINGInternal — populated by the projectStore on the frontend.
parent_output_idINT00–2147483647Internal — lineage parent set by spawn handlers on the frontend.
key_colorSTRING#00FF00
similarityFLOAT0.100.01–1
blendFLOAT0.050–1
despill_mixFLOAT0.500–1
despill_expandFLOAT0.000–1
outputCOMBOalpha2 options: alpha, matte
videooptCOMFYTV_VIDEO

Outputs (1)

NameTypeDescription
videoCOMFYTV_VIDEO