This guide is based on the official MatAnyone and MatAnyone 2 GitHub pages and NVIDIA's official specifications, all checked on 6 December 2026. Neither project publishes a minimum graphics card or VRAM figure, so the hardware advice below is our general guidance rather than measured results.
Video matting is the job of cutting a person (or another subject) out of every frame of a video, complete with a soft-edged alpha matte for hair and motion blur, so you can drop them onto a new background without a green screen. MatAnyone, from Nanyang Technological University's S-Lab and SenseTime Research, is an open video matting project. Its first version was presented at CVPR 2025, and MatAnyone 2, released with inference code in March 2026, is listed by its authors as a CVPR 2026 Highlight paper. Both run entirely on your own PC, so your footage never leaves it.
If you only need to cut out still images, our guide to running BEN3 background removal locally is a simpler place to start. If you want a faster tool that needs no mask at all, see our MatAnyone vs Robust Video Matting comparison.
What you need
A PC with an NVIDIA graphics card. MatAnyone 2's Python example loads the model on cuda:0, which means an NVIDIA GPU with CUDA. Neither project lists a minimum VRAM figure. In our view a modern card with 8GB is a sensible starting point for short clips, and 16GB gives more headroom for long or 1080p and higher videos. Our best GPUs for AI video matting guide goes into more detail.
Python and a package manager. The MatAnyone 2 instructions create a Conda environment with Python 3.10, or you can install it with uv.
FFmpeg, which the official instructions say is required for the optional Gradio demo.
Your video as an MP4, MOV or AVI file, or a folder of frames.
A first-frame mask: a black-and-white image marking the person you want to keep in the first frame. This is the key difference from many other tools.
Step 1: Install MatAnyone 2
Following the official README, clone the repository and set up an environment:
git clone https://github.com/pq-yang/MatAnyone2
cd MatAnyone2
conda create -n matanyone2 python=3.10 -y
conda activate matanyone2
pip install -e .
pip3 install -r hugging_face/requirements.txt
The last line is only needed for the point-and-click Gradio demo. The pretrained model, matanyone2.pth, can be downloaded from the project's GitHub release page into a pretrained_models folder, and the README says it will also be downloaded automatically the first time you run it.
Step 2: Make a first-frame mask (or use the demo)
MatAnyone takes a video plus a segmentation mask for the first frame, and then follows that subject through the rest of the clip. The authors suggest creating the mask with an interactive segmentation model such as SAM 2. Our guide to running SAM 3 locally covers a newer model from the same family.
The easier route is the project's Gradio demo, which you can launch locally:
cd hugging_face
python app.py
According to the README, you drop in your video, pick the target with a few clicks and get the matting results, with no need to prepare a mask file yourself.
Step 3: Run matting from the command line
If you have your own mask, run:
python inference_matanyone2.py -i myclip.mp4 -m myclip_mask.png
or use the matanyone2 command-line tool that was added in March 2026 (run matanyone2 --help to see every option). Results go to the results folder as two videos: the foreground and the alpha matte.
Two options are worth knowing:
--save-image saves per-frame images instead of only videos, which is handy for importing into an editor.
--max-size caps the input resolution. By default there is no limit, so if a 4K clip is too much for your graphics card, this is the setting to try first.
Step 4: Composite onto a new background
The alpha video is a greyscale matte: white is the subject, black is the background. Most video editors can use it as a luma matte or track matte to place your subject over new footage. Our guide to DaVinci Resolve's AI tools covers an editor that handles this well.
Original MatAnyone or MatAnyone 2?
The original MatAnyone repository now points visitors to MatAnyone 2 as its newer release. The first version used Python 3.8 in its instructions and remains available, with training code released in March 2026. For new projects, we'd start with MatAnyone 2.
A note on the licence
Both MatAnyone versions are released under the NTU S-Lab License 1.0, not a standard open-source licence, and the authors say redistribution and use should follow it. Read the licence on GitHub before using either in paid client work.