ComfyUI Node Runs on cloud

BRIAAI Matting

A solid per-frame background remover with a licensing asterisk

By Fannovel16·Created 3 years ago·Updated 2 years ago· 227
BRIAAI Matting
  • video_frames
  • IMAGE
  • MASK
versionv1.4
fp16true
bg_colorgreen
batch_size4

BRIAAI Matting runs BRIA's RMBG-1.4 on your video frames, and it's worth being clear about what that means: this is a per-frame background remover wearing a "matting" hat. When RMBG-1.4 shipped in February 2024 the community called it the best background-removal model around, and for stills it's genuinely good. But the moment you feed it video, remember it has no memory. Every frame is cut independently, which is exactly how you get a mask that flickers.

It's the second node in Fannovel16's tiny ComfyUI-Video-Matting pack, sitting next to the Robust Video Matting node. If you've only got one job - cut the subject out of a short clip, one take, done - this is the simpler of the two. If you're compositing longer footage, read the last section before you commit.

How it works

On first run it pulls a ~177MB model.pth from the briaai/RMBG-1.4 HuggingFace repo into ComfyUI/custom_nodes/ComfyUI-Video-Matting/ckpts/. The architecture is the U2-Net family - REBNCONV blocks and RSU modules, the same skeleton that powers rembg's classic u2net, just tuned by BRIA.

Per frame it:

  • Resizes to a fixed 1024x1024 internally, normalizes, and runs the network.
  • Min-max normalizes the output into a soft 0–1 alpha mask, upscales it back to your frame's size, and composites the subject onto your bg_color.

Two things stand out vs. its sibling. First, the mask is soft - fractional alpha, not a hard threshold - so hair and edges keep some feathering. Second, there's no recurrence and no cross-frame state, so the per-frame independence is baked into the design, not a bug.

The inputs

  • video_frames (IMAGE) - your frame batch from any video loader.
  • version - an enum with exactly one choice (v1.4). It's a fixed model; nothing to pick here.
  • fp16 (BOOLEAN, default true) - casts the loaded model to half precision at runtime. Same file either way, no accuracy cost worth noticing.
  • bg_color (STRING, default "green") - any CSS color name or hex; the flat color composited behind the subject in the IMAGE output.
  • batch_size (INT, default 4) - frames per pass; raise it if your RAM can take it.

Outputs are IMAGE (subject on your bg_color) and MASK (the soft alpha), which you can wire into a composite, a mask input, or SetLatentNoiseMask.

Installing it

Same pack, same steps as its sibling. ComfyUI Manager, search "ComfyUI-Video-Matting", or:

cd ComfyUI/custom_nodes
git clone https://github.com/Fannovel16/ComfyUI-Video-Matting

Restart, then let the first run fetch the model from HuggingFace. Dependencies are just einops and Pillow - torch and torchvision come with ComfyUI.

The licensing asterisk

This is the part people miss, because the README says nothing about it. RMBG-1.4's HuggingFace card declares license: other, and BRIA's terms are non-commercial only. It was flagged in the release thread the day it came out - "RMBG V1.4 can be used for non-commercial projects only" - and it's why a chunk of the community immediately started building their own equivalent. If you're shipping a product or doing paid client work, this model is a legal trap; reach for BiRefNet (MIT) or InSPyReNet instead. For personal projects, no problem.

RVM or BRIAAI?

If you're cutting up a still, or a clip short enough that flicker won't register, BRIAAI gives you a softer, arguably cleaner matte than RVM's hard threshold. If the video runs more than a couple of seconds and you're compositing it, the per-frame flicker will find you - that's the whole reason Robust Video Matting exists, and it's the one I'd reach for. Also note the internal 1024x1024 resize: a 4K frame gets downscaled and its mask upscaled back, so don't blame the node when 4K edges come back soft.

CategoryVideo Matting

Inputs (5)

NameTypeDefaultDescription
video_framesIMAGE
versionCOMBOv1.41 options: v1.4
fp16BOOLEANtrue
bg_colorSTRINGgreen
batch_sizeINT41–64

Outputs (2)

NameTypeDescription
IMAGEIMAGE
MASKMASK