Nodes/ComfyUI-YogurtSa2VA/Yogurt Sa2VA Video Segmentation
ComfyUI Node

Yogurt Sa2VA Video Segmentation

Segment every frame of a video with one text prompt

By yogurt7771·Created 4 months ago·Updated 4 months ago· 0
Yogurt Sa2VA Video Segmentation
  • sa2va_model
  • images
  • text_output
  • masks
segmentation_promptPlease provide segmentation masks for the objects in this video.
threshold0.50
morphnone
erode_kernel3
dilate_kernel3
iterations1

The image node is great, but the reason Sa2VA's "V" exists is video. Yogurt Sa2VA Video Segmentation takes a batch of frames, applies your one text prompt to all of them at once, and returns a mask per frame - no per-frame boxing, no tracking, no magic. You describe the object once ("the red car") and it follows it through the clip, which is exactly what you need to rotoscope a subject out of footage or build per-frame inpaint masks for a video-to-video workflow.

How it works

Mechanically it's the image node with the tensor iterated: every frame in the images batch becomes a PIL image, all of them get passed to Sa2VA's predict_forward as a video (video=[frame1, frame2, ...]) in one inference call, and the returned masks are converted to ComfyUI MASK tensors at the frame size. The same post-processing pipeline applies - threshold for binarization, then optional morph cleanup (opening/closing/erode/dilate with kernel sizes and iteration count).

Important reality check: Sa2VA segments per frame, it doesn't do temporal propagation like SAM2's video mode. There's no tracking memory carrying the object across frames - each frame is understood on its own. In practice that's usually fine because Sa2VA is good at this, but it means the cost scales linearly with frame count, and a long clip will eat a lot of VRAM and time. Feed it what you actually need, not the whole 10 minutes.

Inputs

  • sa2va_model - from Yogurt Sa2VA Model Loader. One load, all the frames.
  • images - a batch of frames, i.e. any ComfyUI IMAGE that's more than one frame. Load with a video loader (VHS / Load Video) or feed it frames from a Load Image batch. The tooltip says it plainly: "Batch of images or video frames to segment."
  • segmentation_prompt - the one description applied across every frame. Default is "Please provide segmentation masks for the objects in this video." Be specific; the model holds the whole sentence, so "the cyclist in the yellow jersey" works.
  • threshold - probability → binary cutoff, 0.5 default. Same Qwen-series caveat as the image node: the slider only has teeth on patched Qwen models; others use the model's default binarization.
  • morph + erode_kernel / dilate_kernel / iterations - per-frame cleanup. opening is your friend for killing single-frame sparkle noise.

Out: text_output (STRING) and masks (MASK, one per frame). Pipe the masks into the matching frame pipeline of your video compositor or inpaint chain, keeping the frame order aligned.

Install & gotchas

Pack-level install as always: clone into custom_nodes, pip install -r requirements.txt, restart. Models in ComfyUI/models/sa2va or auto-downloaded. The video node inherits the pack's three recurring sharp edges:

  • Dropdown empty after copying models - no config.json in the folder structure, or ComfyUI not restarted.
  • 8-bit fails to load - bitsandbytes missing; install or disable use_8bit.
  • Memory - this is the hungriest node in the pack because it's a batch operation. If you're hitting OOM on a clip, drop the frame count, drop resolution, or let use_8bit eat the reload latency.

One more practical note: run it from a cached loader, not cold. With the reusable sa2va_model object this node is just frames-in, masks-out - which is the whole selling point of this fork over the version that reloaded Sa2VA per node.

CategoryYogurtSa2VA

Inputs (8)

NameTypeDefaultDescription
sa2va_modelYOGURT_SA2VA_MODEL
imagesIMAGEBatch of images or video frames to segment.
segmentation_promptSTRINGPlease provide segmentation masks for the objects in this video.Text prompt describing what objects to segment across all frames.
thresholdFLOAT0.500–1Threshold for converting probability masks to binary masks.
morphCOMBOnone5 options: none, opening, closing, erode, dilate
erode_kernelINT31–50
dilate_kernelINT31–50
iterationsINT11–10

Outputs (2)

NameTypeDescription
text_outputSTRING
masksMASK