Keyer
ComfyTV's Keyer and why matte ≠ composite
- video
- in_mask
- out_mask
- bg_video
- video
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,screenornone. Luminance keys on brightness (good for smoke, light, white screens);color/screenkeys on the pickedkey_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,premultorcomposite. This is the one beginners trip on: the default ismatte, 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 tocomposite(withbg_videowired) 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.
Inputs (17)
| Name | Type | Default | Description |
|---|---|---|---|
| force_run_token | INT | 00–2147483647 | Internal — bumped on Run to invalidate ComfyUI's input cache. |
| project_id | STRING | Internal — populated by the projectStore on the frontend. | |
| parent_output_id | INT | 00–2147483647 | Internal — lineage parent set by spawn handlers on the frontend. |
| mode | COMBO | luminance | 4 options: luminance, color, screen, none |
| key_color | STRING | #000000 | — |
| softness_lower | FLOAT | -0.50-1–0 | — |
| tolerance_lower | FLOAT | 0.00-1–0 | — |
| center | FLOAT | 1.000–1 | — |
| tolerance_upper | FLOAT | 0.000–1 | — |
| softness_upper | FLOAT | 0.500–1 | — |
| despill | FLOAT | 1.000–2 | — |
| despill_angle | FLOAT | 1200–180 | — |
| output | COMBO | matte | 4 options: alpha, matte, premult, composite |
| videoopt | COMFYTV_VIDEO | — | |
| in_maskopt | COMFYTV_IMAGE | — | |
| out_maskopt | COMFYTV_IMAGE | — | |
| bg_videoopt | COMFYTV_VIDEO | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| video | COMFYTV_VIDEO | — |