demobook

ComfyUI: Creating a single-frame mask with SAM 2

Demo summary

The demo shows how to use the Point Editor and SAM 2 nodes to generate a mask for only the first frame of the video, as required by Mocha.

Step-by-step

  1. Use the Point Editor nodes to define the area of the character to be replaced
  2. Connect the Point Editor output to the SAM 2 model node
  3. Add a Get Image from Batch node
  4. Set the Start Index to 0
  5. Set the Number of Frames to 1
  6. Feed the single frame into the SAM 2 process

Watch out for

  • Mocha requires only a single mask from the first frame of the video

Tips

  • If you are unfamiliar with Point Editor nodes, refer to the creator's previous video for a detailed explanation

All demos from “Mocha vs Wan2.2 Animate: Best Workflow for PERFECT Character Replacement in ComfyUI

  1. 4:221:26Configuring Mocha Embeds in ComfyUIThe creator demonstrates how to set up the Mocha Embeds node in ComfyUI, connecting the VAE model, reference video, first-frame mask, and character reference images.ComfyUIAI Image Generator
  2. 5:500:25Processing reference video for MochaThe video shows how to use the Load Video and Image Scale nodes to prepare the reference video frames and prevent RAM overflow.ComfyUIAI Video Editor
  3. 6:150:37Creating a single-frame mask with SAM 2CurrentThe demo shows how to use the Point Editor and SAM 2 nodes to generate a mask for only the first frame of the video, as required by Mocha.ComfyUIAI Video Editor
  4. 6:520:39Preparing character reference imagesThe creator demonstrates resizing and padding a target character image to match the video aspect ratio using color padding to avoid distortion.ComfyUIAI Expand Image
  5. 8:521:04Replacing a dancing character with MochaA concrete demonstration of replacing a woman dancing in a video with a new character using the Mocha workflow in ComfyUI.ComfyUIVideo to Video
  6. 12:450:58Replacing a human with an animated werewolfThe video demonstrates replacing a human actor with a stylized werewolf character while maintaining consistent textures and movement.ComfyUIVideo to Video
  7. 13:431:00Lip sync character replacement with MochaThe creator shows Mocha's ability to sync the lip movements of a new character (both human and animated) with the original video's audio.ComfyUIAI Lip Sync Generator
  8. Watch “Mocha vs Wan2.2 Animate: Best Workflow for PERFECT Character Replacement in ComfyUI” →

AI Video Editor

  1. 14:113:23Segmenting video characters with green and red dotsA detailed walkthrough of using the segmentation tool in ComfyUI to define which character to replace by placing positive (green) and negative (red) points.AI Search
  2. 20:540:27Modifying ComfyUI nodes for single video outputThe user demonstrates how to bypass the concatenation node to output only the generated video instead of a side-by-side comparison.AI Search
  3. 5:500:25Processing reference video for MochaThe video shows how to use the Load Video and Image Scale nodes to prepare the reference video frames and prevent RAM overflow.SOTAI
  4. 6:150:37Creating a single-frame mask with SAM 2CurrentThe demo shows how to use the Point Editor and SAM 2 nodes to generate a mask for only the first frame of the video, as required by Mocha.SOTAI