ComfyUI  >  Workflows  >  MatAnyone Video Matting | Single Mask Removal

MatAnyone Video Matting | Single Mask Removal

MatAnyone delivers exceptional video background removal using just a single initial mask frame. Unlike traditional methods requiring frame-by-frame editing, this workflow preserves remarkable detail across thousands of frames while maintaining precise edge definition. Optimized for rapid precision in production scenarios demanding clean subject separation, MatAnyone produces cinema-ready alpha mattes with minimal effort.

ComfyUI MatAnyone Workflow

MatAnyone Video Matting in ComfyUI | AI Background Removal
Want to run this workflow?
  • Fully operational workflows
  • No missing nodes or models
  • No manual setups required
  • Features stunning visuals

ComfyUI MatAnyone Examples

ComfyUI MatAnyone Description

1. What is the ComfyUI MatAnyone Workflow?

The ComfyUI MatAnyone workflow integrates the powerful MatAnyone AI video matting model into the ComfyUI environment. Developed to remove video backgrounds using just one initial mask frame, MatAnyone provides precise, consistent, and high-quality alpha matte extraction across entire videos. This workflow significantly simplifies the traditional frame-by-frame masking process, delivering remarkable stability and clarity in subject isolation.

2. Benefits of ComfyUI MatAnyone:

  • Single-Frame Efficiency:
    MatAnyone requires only one mask frame to remove backgrounds across thousands of video frames.
  • Automatic Mask Generation:
    MatAnyone automatically generates a high-quality initial mask using the built-in RemBG feature, simplifying your workflow even further.
  • High Precision Edges:
    MatAnyone ensures exceptional detail preservation and crisp edge accuracy in video matting.
  • Optimized Workflow:
    Designed specifically for filmmakers, VFX artists, and content creators demanding efficient, cinema-ready results.

3. How to Use the ComfyUI MatAnyone Workflow

3.1 Generation Steps with ComfyUI MatAnyone:

Example Setup for MatAnyone:

  1. Prepare Video and Mask:
    • In the Load Video node, upload your source video.
  2. Apply Mask with MatAnyone: (no action required)
    • Connect your prepared mask frame to the MatAnyone Video Kytra node to initiate precise background removal automatically across the entire video.
  3. Final Video:
    • The output video with background removed is in the Video Combine node.

NOTE:
By default, MatAnyone automatically generates the initial mask using the RemBG Session node. If you prefer using your own mask, simply replace this node with the "Load Image (as Mask)" node.

3.2 Parameter Reference for ComfyUI MatAnyone:

RemBG Session Node:
Generates an initial high-quality mask using the RemBG model (isnet-general-use) to simplify the mask extraction process.

MatAnyone Video Kytra Node:
Applies single-mask background removal to videos.

  • warmup_frames: Number of initial frames for model initialization.
  • erode_kernel: Erosion kernel size to refine alpha matte edges.
  • dilate_kernel: Dilation kernel size to adjust boundary smoothing.
  • bg_red, bg_green, bg_blue: RGB values for replacement background color.

3.3 Advanced Tips for ComfyUI MatAnyone:

  • Mask Frame Quality:
    Ensure your initial mask frame has clear, sharp boundaries to optimize MatAnyone's matting accuracy.
  • Adjustment of Kernel Sizes:
    Use erosion and dilation parameters to precisely tune edge sharpness and smoothness depending on your source video.
  • Manual Mask Recommended for Optimal Results:
    While automatic mask generation via the RemBG Session node is convenient, providing your own manually created mask typically yields superior matting results.

3.4 Important Notes for Manual Mask Uploads:

When uploading your mask using the "Load Image (as Mask)" node, select the appropriate channel according to your mask type to ensure accurate results. Incorrect selection can cause unexpected visual artifacts.

  • RGB black-and-white masks (no transparency): choose RGB channel
  • True Alpha masks (with transparency): choose Alpha channel
  • Colored RGB images: not intended as masks

More Information about MatAnyone

For additional details and technical references:

  • ComfyUI implementation of MatAnyone by
  • Original MatAnyone matting framework

Acknowledgements

This workflow is powered by the MatAnyone model developed by Peiqing Yang, Shangchen Zhou, Jixin Zhao, Qingyi Tao, and Chen Change Loy from Nanyang Technological University and SenseTime Research. The ComfyUI MatAnyone integration is provided by KytraScript, enabling efficient single-frame mask-based background removal. Full credit goes to the original authors for their pioneering work.

Want More ComfyUI Workflows?

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Playground, enabling artists to harness the latest AI tools to create incredible art.