Video Matting: Extract Masks From Videos
Upload a video and get back the isolated foreground and a mask video of the subject. Useful for compositing and as a mask source for other video workflows.
- A10G
- Video editing
- Free template
How it works
The video input feeds a VHS_LoadVideo node from the VideoHelperSuite, which splits the clip into frames. An ImageScaleBy node scales the frames before processing, which keeps the matting step fast on longer clips.
The scaled frames go into the Robust Video Matting node using the resnet50 variant. It produces a foreground image sequence and an alpha matte for every frame. A MaskToImage node converts the matte into a viewable grayscale image sequence.
Three VHS_VideoCombine nodes then assemble the results into videos, so you can save the foreground and the mask separately.
Tips
- Shoot or choose footage where the subject is clearly separated from the background. Matting models handle hair and soft edges well, but busy scenes are harder.
- Lower the ImageScaleBy factor for long videos to cut processing time. Raise it when you need finer edges.
- Use the mask video as a track matte in your editor, or feed it to other ComfyUI video workflows that accept masks.
- Keep the clip short while testing, then run the full video.
Run it as an API
With a single video input, this workflow is simple to deploy on ComfyDeploy as an endpoint that returns the foreground and mask.
What you can use it for
- Cutting a person out of footage without a green screen
- Making mask clips for compositing in an editor
- Preparing subject masks for later video effects
- Quick background removal tests
Run it in three steps
Open the template
Click Run on ComfyDeploy. The workflow, its custom nodes and models are set up for you on a cloud machine.
Add your inputs
Provide input video in the playground or the ComfyUI editor.
Run, share or deploy
Run it on an A10G, share it with your team as a playground, or deploy it as an API endpoint.
Frequently asked questions
What GPU does this video mask workflow need?
It runs on an A10G on ComfyDeploy. The graph is small, with only 8 nodes.
Which model extracts the mask?
The Robust Video Matting node, set to the resnet50 variant.
How do I run it as an API?
Deploy it on ComfyDeploy and send a video to the input_video input. The foreground and mask videos are the outputs.


