Nodes/TrentNodes/CorridorKey Green Screen Keyer
ComfyUI Node

CorridorKey Green Screen Keyer

Green screen keying that keeps the hair, not the halo

By TrentHunter82·Created 9 months ago·Updated 4 days ago· 36
CorridorKey Green Screen Keyer
  • images
  • mask
  • background_images
  • composite
  • alpha_matte
  • foreground
bg_colorgreen
refiner_scale1.0
despill_strength1.0
input_is_linearfalse
auto_despeckletrue
despeckle_size400
edge_refine0
mask_expand0

Traditional chroma keying makes a binary decision per pixel: green or not green. That's why hair, motion blur, and out-of-focus edges come out as green fringes and hard halos. CorridorKey - the neural keyer from Corridor Digital, the VFX YouTube studio - takes a different route: it doesn't decide "is this green," it unmixes the true foreground color from the green background, so a semi-transparent wisp of hair keeps its actual color instead of becoming a matte-shaped hole. This node wraps that model for ComfyUI and, like the best background-removal tooling in the ecosystem, it rides on BiRefNet for the parts it doesn't do itself.

Here's the flow under the hood, and it's a good example of the pack's VRAM discipline. If you don't provide a mask, BiRefNet auto-generates an alpha hint per frame - then it's freed from VRAM before the CorridorKey model loads, because CorridorKey needs its own ~3–5GB. The keyer then produces three things: a clean straight (un-premultiplied) foreground with the green removed, a linear alpha matte, and a composite over your chosen background. "Straight foreground" matters if you're re-compositing elsewhere - it's the professional delivery form, not a pre-multiplied RGB-into-alpha mess.

What you set

  • images - required green-screen footage; processed per frame.
  • mask - optional alpha hint / garbage matte. Skip it and BiRefNet does the work (it's in ComfyUI core, MIT, the default cutout model of the ecosystem).
  • bg_color - green, blue, aqua, white, black, transparent (RGBA output), or none (returns originals unchanged). Default green.
  • background_images - optional custom background; overrides bg_color when connected, auto-resized, single image broadcast to all frames.
  • refiner_scale - the CNN refiner strength; 1.0 standard, higher pushes edge detail at artifact risk.
  • despill_strength - green spill removal, 1.0 = full despill. This is the "no more green rim on the shoulders" knob.
  • input_is_linear - enable for linear-space EXR input; default assumes sRGB/REC709 camera footage.
  • auto_despeckle + despeckle_size - auto-removes small disconnected alpha blobs like tracking markers (default 400 px min area).
  • edge_refine and mask_expand - Gaussian feather radius and grow/shrink of the matte.

Outputs: composite (RGBA when bg_color=transparent), alpha_matte, and foreground - each tooltip-described as straight color, linear matte, and recomposable foreground respectively.

The model download and gotchas

The CorridorKey weights (~300MB) auto-download from HuggingFace on first use, and it needs timm + einops (in the pack's requirements) for the Hiera backbone. First run pays the download and the VRAM swap; expect a pause while BiRefNet frees up before CorridorKey loads.

Two things to check when the matte looks wrong: if hair edges go hard, lower refiner_scale slightly rather than cranking edge_refine - feather fixes are cosmetic, the refiner is structural. And if you're keying footage shot in a log or linear pipeline, forgetting input_is_linear gives you a green-tinted, muddy matte; flip it on for EXR. The pack's requirements also pull transformers for BiRefNet, so a pre-existing ComfyUI with a pinned transformers version can see the usual version dance - Manager handles most of it, and pip install -r requirements.txt sorts the rest.

Install: ComfyUI Manager (search "Trent Nodes"), or git clone https://github.com/TrentHunter82/TrentNodes into custom_nodes/ + pip install -r requirements.txt. This is one of the pack's heavyweight nodes - it earns the download, and for hair-heavy green screen work it beats the classic keyers by a visible margin.

CategoryTrent/Video

Inputs (11)

NameTypeDefaultDescription
imagesIMAGEGreen screen footage (image batch); CorridorKey unmixes foreground color from the green background per frame
maskoptMASKAlpha hint / garbage matte; rough black-and-white mask isolating the subject. If not provided, BiRefNet auto-generates one per frame
bg_coloroptCOMBOgreenBackground color for composite output; 'transparent' outputs RGBA with alpha embedded; 'none' returns original images unchanged
background_imagesoptIMAGEOptional custom background; overrides bg_color when connected. Auto-resized to match input. Single image is broadcast to all frames
refiner_scaleoptFLOAT1.00–2CNN refiner strength; 1.0 is standard. Higher pushes edge detail but may introduce artifacts
despill_strengthoptFLOAT1.00–2Green spill removal; 1.0 is full despill, 0.0 disables. Removes green fringing on edges and translucent areas
input_is_linearoptBOOLEANfalseEnable if input is linear color space (EXR). Default assumes sRGB/REC709 camera footage
auto_despeckleoptBOOLEANtrueAuto-remove small disconnected alpha regions like tracking markers and background noise
despeckle_sizeoptINT4000–2000Minimum pixel area to keep; alpha regions smaller than this are removed. Higher = more aggressive cleanup
edge_refineoptINT00–10Gaussian feather radius for soft matte edges; 0 = sharp edges from CorridorKey
mask_expandoptINT0-20–20Grow or shrink the matte boundary; positive expands foreground, negative shrinks

Outputs (3)

NameTypeDescription
compositeIMAGEForeground composited over the selected background color or custom background; RGBA (4-channel) when bg_color=transparent
alpha_matteMASKClean linear alpha matte from CorridorKey (white = foreground)
foregroundIMAGEStraight (un-premultiplied) foreground color with green screen removed; useful for re-compositing in other tools