ComfyUI Node

Keyer

ComfyTV's Keyer and why matte ≠ composite

By jtydhr88·Created 3 months ago·Updated about 16 hours ago· 725
Keyer
  • video
  • in_mask
  • out_mask
  • bg_video
  • video
force_run_token0
project_id
parent_output_id0
modeluminance
key_color#000000
softness_lower-0.50
tolerance_lower0.00
center1.00
tolerance_upper0.00
softness_upper0.50
despill1.00
despill_angle120
outputmatte

The Keyer is the serious end of ComfyTV's green-screen suite. Chroma Key gets you a fast cutout, but when the footage is noisy, the screen is unevenly lit, or you need a matte that survives a real composite, you pull a key - and that's a different, fussier job with its own vocabulary. Keyer is the node that speaks that vocabulary: tolerance, softness, spill suppression, and a matte you can actually inspect before it ever touches a background.

ComfyTV is the canvas-style app layer on ComfyUI where every operation is its own node. The Keying category chains together as Keyer → Matte Morphology → Key Mix, which is the standard "pull it, clean it, put it over a background" flow.

How it works. The Keyer measures each pixel's distance from a reference key_color (or from luminance) and turns that distance into an alpha ramp with independently controllable tolerance and softness bands on both sides of a center pivot. Tighter tolerance keys the screen; wider softness feathers the transition so you don't get a crunchy edge. It can also despill - removing the green/blue contamination that bleeds onto the subject - and the whole thing runs as a per-frame torch op, with live preview in the node body. When you wire in_mask/out_mask images or a bg_video, it switches into a multi-source mode that respects those holdout mattes.

The inputs that matter. The force_run_token, project_id and parent_output_id inputs are internal plumbing - leave them. What you actually drive:

  • mode - luminance, color, screen or none. Luminance keys on brightness (good for smoke, light, white screens); color/screen keys on the picked key_color.
  • key_color - the reference color, hex. This is your "pick the green".
  • tolerance_lower / tolerance_upper / softness_lower / softness_upper / center - the keyer's guts. Center is the pivot; tolerance is how far out pixels get cut; softness feathers the falloff. Start from defaults, nudge, and watch the preview.
  • despill / despill_angle - spill suppression strength and the screen's angle in the color wheel. The 120° default is aimed at green; drop it or rotate for blue screens.
  • output - alpha, matte, premult or composite. This is the one beginners trip on: the default is matte, i.e. you get the black-and-white alpha, not your subject over a background. That's deliberate - you inspect the matte before you composite. Switch to composite (with bg_video wired) when you're ready to see it over the real background.

Output is a single video - a COMFYTV_VIDEO that feeds the next stage in the keying chain.

Install. Install the pack once:

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

Restart ComfyUI (full restart, not just a browser refresh) and the stage appears under ComfyTV → Keying. ComfyUI Manager - search "ComfyTV" - works the same. Zero Python dependencies (the pack's pyproject.toml dependency list is empty); no model downloads for keying either, it's all math on your GPU. Desktop/multi-install users: clone into the running instance's path from the startup log, or the node won't register.

Where people get burned. Thinking the default output is your finished composite. It's not - matte shows the alpha, and if you plug that straight into a player you'll think the key failed. Second: green spill on the subject's shoulders reads as a green fringe no amount of tolerance fixes; that's what despill is for. And if the matte looks jagged frame to frame, don't fight it here - that's exactly what the Matte Morphology stage (choke/spread) is for, and it's why it sits right after this node in the chain.

CategoryComfyTV/Keying

Inputs (17)

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.
modeCOMBOluminance4 options: luminance, color, screen, none
key_colorSTRING#000000
softness_lowerFLOAT-0.50-1–0
tolerance_lowerFLOAT0.00-1–0
centerFLOAT1.000–1
tolerance_upperFLOAT0.000–1
softness_upperFLOAT0.500–1
despillFLOAT1.000–2
despill_angleFLOAT1200–180
outputCOMBOmatte4 options: alpha, matte, premult, composite
videooptCOMFYTV_VIDEO
in_maskoptCOMFYTV_IMAGE
out_maskoptCOMFYTV_IMAGE
bg_videooptCOMFYTV_VIDEO

Outputs (1)

NameTypeDescription
videoCOMFYTV_VIDEO