Nodes/ComfyUI_CineStyle/CS Video Segment (SAM3.1)
ComfyUI Node

CS Video Segment (SAM3.1)

Point at an object once, get a mask that follows it through the whole clip

By chflame163·Created 26 days ago·Updated 3 days ago· 72
CS Video Segment (SAM3.1)
  • model
  • images
  • video_input
  • MASK
  • anchor_mask
  • video_info
anchor_frame0
propagation_directionboth
max_objects16
wait_for_input_cachefalse
prompt_data{"version":2,"objects":[]}

SAM3 is the current mainstream tier of Meta's segmentation line - the one that added promptable concept segmentation (say "person," get every matching instance) on top of SAM2's video memory. CS Video Segment (SAM3.1) is CineStyle's take on it: instead of making you chain a detector, a SAM node and a dozen plumbing nodes, you open a Selector UI, drop your prompts on one frame, and the mask propagates both directions through the video. If you've ever used SAM2 video tracking and wished the prompt editor weren't a bunch of raw JSON, this is the friendlier door.

How it works

The node doesn't ship its own model - you load the official SAM3/SAM3.1 checkpoint with ComfyUI's standard CheckpointLoaderSimple, then connect it to model. That's a deliberate choice: one model, one loader you already know, no hidden weight downloads inside the node. Give it your video as an IMAGE batch (images, preferred) or a VIDEO (video_input), click Open Selector, and define objects on an anchor frame. The Selector supports the full SAM3 prompt menu - semantic text, rough mask, BBox, positive/negative points, and multiple objects at once. SAM3.1's multiplexed object slots handle several objects in one pass rather than re-running per object.

The inputs that matter

  • model - the SAM3/SAM3.1 model from CheckpointLoaderSimple. Required.
  • images / video_input - the video. images wins if both are connected; wire one or the node errors out.
  • anchor_frame - the frame your prompts live on, 0-based. The Selector writes it for you in normal use.
  • propagation_direction - both (default), forward, or backward.
  • max_objects - how many SAM3.1 multiplex object slots to allow, default 16. Fine where it is.
  • prompt_data - the serialized JSON of your prompts. The tooltip's advice is right: don't hand-edit it; the Selector manages it.

Optional: proxy_video - a low-res VIDEO that the Selector uses for preview only, so scrubbing through a big clip stays fast. It never affects the real segmentation.

Outputs

  • MASK - [frames, H, W], the full-video propagation result. That's the one you feed compositing, inpainting, or motion pipelines.
  • anchor_mask - the anchor frame's segmentation on its own, handy for checking your prompts before a long run.
  • video_info - dict with frame count, dimensions, anchor frame, direction, object count.

Installing it

Pack install is the usual:

cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_CineStyle.git

or via ComfyUI Manager → ComfyUI_CineStyle, then restart. The real setup is the checkpoint: grab a SAM3.1 model from Comfy-Org/sam3.1 and drop it into ComfyUI/models/checkpoints, where CheckpointLoaderSimple will find it. If you already run SAM3 for image work, you already have it.

Where people get burned

  • Missing model = missing node context. If you only see "no model", you forgot the checkpoint or loaded a wrong one. It must be the SAM3/SAM3.1 line, not a diffusion checkpoint.
  • Dynamic inputs need a warm-up run. If your frames come from a node that generates them at runtime, execute once to build the Selector cache before you open the editor - otherwise the Selector has nothing to show.
  • Propagation is one anchor, not keyframes. If the object fundamentally changes identity mid-clip, you may need a second anchor - but that means re-defining prompts, and the node clears old prompt data when you switch anchors. Plan the anchor frame deliberately.
Category😺dzNodes/CineStyle/Video

Inputs (8)

NameTypeDefaultDescription
modelMODELOfficial ComfyUI SAM3/SAM3.1 model.
anchor_frameINT00–10000000Frame where the selector prompt is defined.
propagation_directionCOMBObothPropagate toward both sides of the anchor or only one side.
max_objectsINT161–64Maximum SAM3.1 multiplex object slots.
wait_for_input_cacheBOOLEANfalseInterrupt execution when this node is reached after caching its input.
imagesoptIMAGEVideo frames as an IMAGE batch. Connect CS Load Video for Selector input.
video_inputoptVIDEOOptional VIDEO input from CS Load Video.
prompt_dataoptSTRING{"version":2,"objects":[]}Selector multi-object semantic, mask, bbox, and point prompts.

Outputs (3)

NameTypeDescription
MASKMASK
anchor_maskMASK
video_infoDICT