Nodes/ComfyTV/Despill
ComfyUI Node

Despill

Kill the green halo that ruins every greenscreen key

By jtydhr88·Created 3 months ago·Updated about 15 hours ago· 725
Despill
  • video
  • video
force_run_token0
project_id
parent_output_id0
screengreen
spill_mix0.50
expand0.00
red_scale0.00
green_scale-1.00
blue_scale0.00
brightness0.00
output_spillmapfalse

You keyed your greenscreen, the subject is cut out, and then you notice it: a sickly green rim around the hairline and shoulders. That's spill - the screen color bouncing onto the subject and surviving the key. It's the most common thing that makes a key look "homemade," and this is the node that fixes it.

Despill is part of ComfyTV's keying suite, and it belongs after the key, not instead of it. The classic chain is: chroma key → despill → color suppress → matte cleanup → composite. You reach for Despill when the foreground is clean enough but the edges still carry the screen color. If your key itself is garbage, despill won't save it - fix the key first.

How it works

ComfyTV is jtydhr88's canvas app that turns ComfyUI into a TapNow/LibTV-style media workbench - roughly 190 stages, each its own node. The FX and color stages don't each re-decode your video; they attach a small "fx spec" to the video wire, and a downstream renderer applies them in one pass. So Despill is a deterministic per-channel color op, not a model: it takes the color you told it was the screen and pulls that color out of the pixels, with per-channel control over how hard it pulls.

Every ComfyTV stage also carries three hidden inputs - force_run_token, project_id, parent_output_id - marked "Internal" in the schema. The frontend's projectStore fills those in; you never touch them. They're the plumbing behind ComfyTV's per-node Run: a stage re-runs on its own and downstream nodes consume a snapshot of its last output instead of dragging the whole chain through ComfyUI's queue.

The inputs that actually matter

  • screen - green or blue. Pick whichever your background actually was; the whole correction is built around it.
  • spill_mix (0–1, default 0.5) - how much of the detected spill to remove. Start at 0.5 and nudge up until the rim dies, then back off a hair so you don't eat into the subject.
  • red_scale / green_scale / blue_scale (−2 to 2) - per-channel fine-tuning. The defaults already pull green down (green_scale −1 on a green screen), which is the sane starting point; use these when one channel still glows.
  • expand - push the correction out a bit wider into the edges.
  • brightness - compensate if despill darkens the edge.
  • output_spillmap - flip this on to preview where the spill was detected, as a mask. Great for diagnosing why the halo is still there.

The optional video input takes a COMFYTV_VIDEO, and the single video output feeds whatever composites next. No video in, nothing happens - despill is a video-stage operation.

Installing it

ComfyTV installs as one pack. ComfyUI Manager can grab it if you search "ComfyTV", or by hand:

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

Then do a full backend restart. Nodes appear under the ComfyTV category, with this one in Keying.

The gotcha that bites people: on ComfyUI Desktop, macOS, or with multiple ComfyUI installs, that relative cd can clone into the wrong instance and nothing shows up. Clone into the running instance by absolute path, confirm custom_nodes/ComfyTV/__init__.py exists (not a nested ComfyTV/ComfyTV/…), and fully quit and relaunch the app.

The pack ships no requirements.txt and its pyproject declares zero Python deps - ComfyTV is mostly a frontend plus thin io.ComfyNode stages. But the video pipeline lazily imports PyAV (import av), which a bare pip ComfyUI doesn't guarantee. If a video stage dies on import, pip install av into ComfyUI's Python environment.

Common issues

  • Green rim persists - raise spill_mix, then nudge green_scale more negative, and check output_spillmap to confirm you're even hitting the right area.
  • Subject looks drained - you overshot. Lower spill_mix and compensate with brightness rather than ripping out another channel.
  • Wrong screen setting - despilling a blue screen with screen: green actively hurts. Match the dropdown to the footage.
CategoryComfyTV/Keying

Inputs (12)

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.
screenCOMBOgreen2 options: green, blue
spill_mixFLOAT0.500–1
expandFLOAT0.000–1
red_scaleFLOAT0.00-2–2
green_scaleFLOAT-1.00-2–2
blue_scaleFLOAT0.00-2–2
brightnessFLOAT0.00-1–1
output_spillmapBOOLEANfalse
videooptCOMFYTV_VIDEO

Outputs (1)

NameTypeDescription
videoCOMFYTV_VIDEO