MatAnyone
The original video-matting node (and when V2 wins instead)
- src_video
- foreground_mask
- foreground_MASK
- solid_color
- matte
- green_screen
This is the node that started FuouM's pack, and if you googled "MatAnyone" you may have landed here when the newer MatAnyone2 is what you actually want. Honest framing up front: V2 is the improved model, the README now leads with it, and its node takes the same inputs and outputs. The only good reasons to run this one are that you already have matanyone.pth on disk, or you specifically want the original "Stable Video Matting with Consistent Memory Propagation" (arXiv 2501.14677) weights from pq-yang's lab.
The job is identical to the V2 node's: video matting. You feed in a clip plus a single annotated frame, the model warms up on your mask (n_warmup iterations, default 10), generates its own first-frame alpha from that seed, then propagates it through the rest of the footage. Because it's propagating a mask with temporal memory rather than re-segmenting every frame, you get edges that stay put frame to frame - the thing a per-frame BiRefNet pass can't give you without shimmer.
How it works
mask_frame decides the direction of propagation: 0 for first-frame (forward only), the last index for backward, and any middle index for a two-pass run that propagates both ways from that frame. Middle-frame masks are the useful one when your subject is occluded or off-camera at the start - you mask the first frame where they're fully visible and let the model fill in the rest.
The warmup step is worth understanding even if you never touch it. Your mask isn't the final matte; the model iterates on it (n_warmup times, default 10) to produce its own first-frame alpha, then carries that forward. Higher values cost time but can stabilize tricky first frames; lower values run faster and are usually fine.
Inputs and outputs
From the node schema: src_video (IMAGE batch), one of foreground_mask (IMAGE, auto-converted from black/white) or foreground_MASK (MASK), mask_frame, n_warmup, plus optional solid_color, max_internal_size, max_mem_frames, use_long_term. Outputs are matte and green_screen. Notice what's missing compared to V2: no r_erode / r_dilate, so if your seed mask is rough you either clean it outside the node or switch to V2.
Install
Same story as the rest of the pack, and it's a light one - just torch and omegaconf, with the model code vendored in the repo:
cd ComfyUI/custom_nodes
git clone https://github.com/FuouM/ComfyUI-MatAnyone
Or search "ComfyUI-MatAnyone" in ComfyUI Manager and restart. Then drop the checkpoint in place:
# matanyone.pth from https://github.com/pq-yang/MatAnyone
# → ComfyUI/custom_nodes/ComfyUI-MatAnyone/checkpoint/matanyone.pth
No checkpoint, no node - you'll get a FileNotFoundError on load.
Troubleshooting
Most of this is shared with V2. Your seed mask quality decides everything, so generate the first frame's mask with BiRefNet or SAM instead of hand-painting it if you can. When VRAM is the problem on long clips, drop max_internal_size to 480 or 360 and raise use_long_term; the node reloads its checkpoint from disk on every run either way, so the pause before the progress bar fills is expected.
One genuinely nice touch: the example workflow bundled in the pack wires both MatAnyone and MatAnyone2 side by side on the same clip, so you can A/B the original against the sequel without building anything. If you've got the VRAM, that's a free sanity check before you standardize on either.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| src_video | IMAGE | — | |
| mask_frame | INT | 0 | — |
| n_warmup | INT | 10 | — |
| foreground_maskopt | IMAGE | — | |
| foreground_MASKopt | MASK | — | |
| solid_coloropt | IMAGE | — | |
| max_internal_sizeopt | INT | -1 | — |
| max_mem_framesopt | INT | 5 | — |
| use_long_termopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| matte | IMAGE | — |
| green_screen | IMAGE | — |