UniVidX • Decode (Alpha)
A clean alpha matte from any video, no green screen
- result
- composite_rgb
- alpha
- foreground
- background
If you've ever needed to pull a clean matte from a video that wasn't shot in front of a green screen, this is the node you've been waiting for. UniVidXDecodeAlpha takes the sampler's UNIVIDX_RESULT and splits it into four IMAGE batches: composite_rgb, alpha, foreground, and background. It's the alpha-family counterpart to UniVidXDecodeIntrinsic - same shape, different output channels, and it's the pack's answer to "how do I key out a subject when there's no chroma key to work with."
What you get out of it
alpha- the matte. UniVidX's alpha mode produces a genuinely clean, binary-quality mask, which is the hard part of this whole pipeline. Getting fractional-quality edges on hair and motion blur is where image background-removal tools live and die, and video is a much harder version of the same problem.foreground- the subject, already matted.background- the most striking output in the pack's demo: the model inpaints what's behind the subject, so the wallpaper and furniture where the person was sitting get reconstructed rather than left as a hole. That alone makes it useful for set replacement.composite_rgb- the original composite clip.
The demo mode is R2PFB: one composite RGB clip in, matte + foreground + background out. Use those to composite your subject onto a new background, or wire the matte into any downstream node that takes a mask.
How it works
Same mechanism as the intrinsic decoder: it reads the mode string to figure out which modalities were targets and which were conditions. Any modality that was a condition comes back as a black placeholder IMAGE of the right shape, so the graph never breaks - you just get a black stream where your input was. It raises a ValueError if you feed it an intrinsic-family result, and points you at the right decoder. One input (result), four outputs, nothing else to configure.
Gotchas that will trip you up
- Text-only matting (
t2RPFB) produces a white matte. This is a documented model limit, not a bug in your setup. Alpha decomposition really wants the video conditioning, so use theR2PFBworkflow instead. The pack's README calls this out explicitly, and it's the kind of thing people burn an afternoon on. - Black
composite_rgbis correct when composite RGB was your condition. See the intrinsic decoder's "rgb is black" explanation - same placeholder behavior, same non-bug.
Install
It ships with the pack:
cd ComfyUI/custom_nodes
git clone --recurse-submodules https://github.com/dreamrec/UniVidX_ComfyUI.git
cd UniVidX_ComfyUI
python -m pip install -r requirements.txt
python install.py
Restart ComfyUI, and the five nodes appear under UniVidX. For your own footage, the example workflows use VHS_LoadVideoPath, so grab ComfyUI-VideoHelperSuite too. The alpha variant runs slightly slower than intrinsic in the pack's benchmarks (roughly 12.4 min vs 9.4 min per 21-frame chunk on an RTX 5090), and the same 24 GB VRAM floor applies.
Common issues
ValueError: Mode X is not alpha- intrinsic result wired into the alpha decoder. Swap decoders.- White matte from a text-only mode - known limitation; switch to
R2PFBwith a real clip. - Matte with a heavy halo - if you're compositing the foreground over a new background, premultiply the alpha before blending; that's the classic matte artifact and it bites here too.
Bottom line: this is the node that turns a random phone video into a proper keyed subject, and the inpainted background is a genuinely nice bonus. Just don't expect text-only alpha to be any good, and plan for GPU minutes rather than seconds.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| result | UNIVIDX_RESULT | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| composite_rgb | IMAGE | — |
| alpha | IMAGE | — |
| foreground | IMAGE | — |
| background | IMAGE | — |