Nodes/ComfyUI-RogoAI-PromptRelay/RogoAI Prompt Relay Seg Calc
ComfyUI Node

RogoAI Prompt Relay Seg Calc

Stop hand-counting Wan frames

By RogoAI-Takeji·Created 4 months ago·Updated 4 months ago· 1
RogoAI Prompt Relay Seg Calc
    • segment_lengths
    • latent_frames
    frame_num81
    num_segments3

    Once you've wired up the RogoAI_PromptRelayWan node, you'll stare at its segment_lengths field and do the same arithmetic every time: "Okay, 81 frames, that's 21 latent frames, and I want three scenes, so… 7,7,7?" This node is that arithmetic, as a ComfyUI node. Feed it a total frame count and a scene count, and it hands you the exact 7,7,7 string the Wan node wants. It's a tiny utility, but it's the utility that keeps you from breaking a generation on a typo.

    Why the math is non-obvious

    Wan's 3D causal VAE compresses time by a factor of four, so the node doesn't count raw frames - it counts latent frames. From the source: latent_frames = (frame_num − 1) // 4 + 1. Your 81-frame clip is 21 latent frames. That's the number that has to add up across your scene segments, and it's exactly the number people get wrong when they type 7,7,7 by feel. The node then distributes those latent frames as evenly as it can - 21 over 3 scenes becomes 7,7,7; 21 over 2 becomes 11,10 (ceil-rounded, last scene absorbs the remainder).

    The two inputs, the two outputs

    It's a two-input calculator:

    • frame_num (INT, default 81, min 9, max 201, step 4) - the total video frames, same value you're putting in the Wan node. The step-4 constraint mirrors Wan's temporal VAE stride.
    • num_segments (INT, default 3, min 1, max 6) - how many scenes you actually have, i.e. how many non-empty local prompts you filled.

    Outputs:

    • segment_lengths (STRING) - the comma-separated list, e.g. 7,7,7. Wire this straight into RogoAI_PromptRelayWan's segment_lengths input.
    • latent_frames (INT) - the underlying count. Mostly informational, but useful as a sanity check or to feed downstream nodes that care.

    Installing it

    Same pack as the Wan node - this one ships in the same repo:

    cd ComfyUI/custom_nodes
    git clone https://github.com/RogoAI-Takeji/ComfyUI-RogoAI-PromptRelay
    

    or find "ComfyUI-RogoAI-PromptRelay" in ComfyUI Manager. Restart and both nodes appear under RogoAI/PromptRelay. It's pure Python with no dependencies, so it'll load even if you never install WanVideoWrapper - though the Wan node next to it won't.

    When you should skip it

    Honestly, this node only earns its keep when your scenes are evenly timed. If you want a long establishing shot and a quick cut - say 10 latent frames of "she walks in" then 3 of "close-up" - even distribution is wrong, and you'll hand-write 10,3 (or 10,3,8) yourself instead. The Wan node clamps segment sums to the latent frame count rather than erroring on overflow, but it does hard-error if the number of segment lengths doesn't match your local prompts, so keep the count honest either way.

    One trap: the Seg Calc node and the Wan node each compute latent_frames from their own frame_num. Change the frame count here but forget to change it in the Wan node and your neatly computed string silently doesn't match the sampling length. Wire the same frame_num value into both, or just accept the defaults (81) and never think about it again.

    CategoryRogoAI/PromptRelay

    Inputs (2)

    NameTypeDefaultDescription
    frame_numINT819–201
    num_segmentsINT31–6

    Outputs (2)

    NameTypeDescription
    segment_lengthsSTRING
    latent_framesINT