Topview Logo
  • Create viral videos with
    GPT-4o + Ads library
    Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.
    Try it free
    gpt video

    EASY ALPHA MATTES & ROTOSCOPING IN COMFYUI USING SAM2 // Civitai Tutorial

    blog thumbnail

    Introduction

    Welcome to Civitai.com, the home of the generative AI art community! In today’s tutorial, we'll be delving into a simple yet effective workflow using SAM2 and ComfyUI to create high-quality alpha mattes and perform rotoscoping without the usual complexities involved in traditional software like Adobe After Effects.

    Getting Started

    We begin by welcoming viewers from all around the world, including those tuning in from Brazil. As we gather in the live chat, I want to emphasize that today’s tutorial will focus on foundational techniques that will be useful for everyone interested in AI art and video manipulation.

    Understanding the Workflow

    I’ll be guiding you through a straightforward usage of SAM2 within the ComfyUI environment. The workflow will be accessible via a link pinned in the chat, and it comprises a simple JSON file that enables clean alpha mat extraction using Meta's Segment Anything model.

    What You Need

    1. ComfyUI: Make sure you have ComfyUI installed.
    2. Node Packs:
      • Install the "Segment Anything 2" and "Use Everywhere" node packs.

    The "Use Everywhere" node allows for a cleaner workflow by transmitting images uniformly across connected nodes.

    Exploring Segment Anything

    Segment Anything (SAM) is Meta’s AI-based tracking model ideal for creating crisp alpha mattes—a white subject on a black background. This technique can be advantageous across various platforms like After Effects and Da Vinci Resolve.

    Process Overview

    1. Load Video: Import your video file into the workflow.

    2. Load First Frame: Capture the first frame for analysis and segmentation. You can do this with editing software or a media player snapshot feature.

    3. Points Editor Setup:

      • Assign green points to areas you want to keep (white).
      • Assign red points to background areas to exclude (black).
    4. Model Selection: Choose the SAM2 model variant based on your hardware capabilities. For instance, BF16 is recommended for balance in speed and quality.

    5. Auto-Queue: You can enable auto-queuing to see real-time updates as you adjust points to refine your selection.

    Testing Different Scenarios

    To illustrate the method’s effectiveness, we tested various types of footage. One notable result showcased isolating a ballerina dancer seamlessly from her background with minimal flicker. The adaptability of this technique shines when dealing with more complex subjects, showcasing how to adjust the alpha during the editing process.

    Additional Insights

    While tuning the workflow, I shared helpful tips for achieving the best results, such as using additional points strategically on your subject for improved isolation. Furthermore, I encourage experimentation with different video samples to understand how this method responds across varying footage.

    Conclusion

    This process not only streamlines preparing your alpha mattes but also empowers creators to conduct more intricate edits without needing pricey software subscriptions. I hope you found this tutorial on using SAM2 to create alpha mattes valuable. I plan to upload this session to YouTube afterward for future reference.

    Stay tuned for tomorrow's session where we’ll be joined by War Anakin, a professional LORA trainer, who will provide insights into training better LORAs.


    Keywords


    FAQ

    1. What is SAM2?
    SAM2 is Meta's AI-based segmentation model that allows for the creation of clean alpha mattes, helping to distinguish subjects from their backgrounds.

    2. Do I need a powerful computer to use SAM2 in ComfyUI?
    You can use the BF16 model for a balance of speed and quality or opt for lighter options if you have lower-end hardware.

    3. Can I use the alpha mattes in other software?
    Yes, the alpha mattes created can be leveraged in software like Adobe After Effects, CapCut, or Da Vinci Resolve for further editing.

    4. Where can I find the workflow I learned about?
    The workflow is pinned in the video’s chat for easy access, and you can download it to use in your own projects.

    5. Will this tutorial be available later?
    Yes, the live tutorial will be uploaded to YouTube for anyone who missed the session.

    One more thing

    In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

    TopView.ai provides two powerful tools to help you make ads video in one click.

    Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

    Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

    You may also like