Nodes/ComfyUI_FlowRVS/FlowRVS_SM_Cond
ComfyUI Node

FlowRVS_SM_Cond

Your video and prompt become a latent here — that's the whole trick

By smthemex·Created 11 months ago·Updated 7 months ago· 8
FlowRVS_SM_Cond
  • vae
  • positive
  • image
  • cond
value1.00

FlowRVS_SM_Cond is where the "referring" part of referring video segmentation happens. Everything before this node has just been assembling ingredients; this is the node that fuses your text phrase and your video frames into the single latent bundle the FlowRVS model can work from. It looks like a conditioning node, but it's doing a lot more than a text encode.

Three inputs and one widget:

  • positive - a CONDITIONING from a normal CLIPTextEncode. This is your phrase: "the gun", "the person in red". One important detail: the text must be encoded with the umt5 (wan) text encoder, not a CLIP-L or whatever you use for SDXL. The example workflow loads umt5_xxl_fp8_e4m3fn_scaled.safetensors with the wan type in a CLIPLoader, and that's the setup to copy.
  • image - your video frames as an IMAGE batch. Feed it from a video loader; the example uses LoadVideoGetVideoComponents (from VideoHelperSuite) so the frames come in as a single tensor.
  • vae - from FlowRVS_SM_VAE. Used here to encode the video into latents.
  • value - default 1. This is the fill color used when the node has to pad your video's aspect ratio to the 832×480 (or 480×832) shape FlowRVS expects - 1 pads with white, 0 with black. If you see a colored bar at the edge of your masks, this is the widget that caused it.

What actually happens

Internally the node does the unglamorous but critical normalization. It crops or pads your frames to the 832:480 ratio, snaps dimensions to multiples of 16, pads the frame count so that T-1 is divisible by 4 (the Wan VAE compresses time 4×, so the latent needs a valid length), maps pixels to the [-1, 1] range, encodes the whole clip with the Wan VAE, and normalizes the result. It also truncates the prompt embeddings to the first 256 tokens - the changelog's "调整emb长度" fix - because that's the context window the fine-tuned model was trained with.

The cond output is a lie, politely. It's typed as CONDITIONING so it can travel on a normal wire, but it's really a dict carrying the prompt embeddings, the encoded video latent, and the original size/frame-count info the decoder needs later to restore your video's exact dimensions. That's also why you must keep the whole pipeline inside this pack: a stock ComfyUI KSampler or VAEDecode has no idea what this object is. The chain is Cond → FlowRVS_SM_KSampler → FlowRVS_SM_Decoder.

Installing

cd ComfyUI/custom_nodes
git clone https://github.com/smthemex/ComfyUI_FlowRVS.git
pip install -r requirements.txt

ComfyUI Manager works too - search "ComfyUI_FlowRVS". You'll need the four model files the README lists (Wan DiT + FlowRVS DiT for the model loader, Wan VAE + tuned_vae.pth for the VAE loader) and the umt5 text encoder. If omegaconf or opencv aren't importable after install, pip install omegaconf opencv-python.

Troubleshooting

  • "positive" never arrives - you're probably feeding a CLIP-L encoded conditioning. The pack needs the umt5/wan encoder.
  • Masks show a hard bar on one edge - that's the value padding color showing through. Set value to 0 (black) if your video is bright, 1 (white) if it's dark, so the pad blends instead of screaming.
  • Video is too long for VRAM - the whole clip gets encoded in one shot. Shorten the clip rather than raising steps; this model segments, it doesn't need a long context to be useful.
CategoryFlowRVS_SM

Inputs (4)

NameTypeDefaultDescription
vaeVAE
positiveCONDITIONING
imageIMAGE
valueFLOAT1.000–1

Outputs (1)

NameTypeDescription
condCONDITIONING