Nodes/IAMCCS-nodes/Motion Bridge Save ????
ComfyUI Node

Motion Bridge Save ????

Save a WAN segment's tail so the next chunk can pick up cleanly

By IAMCCS·Created 11 months ago·Updated 7 days ago· 113
Motion Bridge Save ????
  • latent
  • images
    namesegment_bridge
    tail_frames2
    save_preview_pngtrue
    flush_vramtrue

    WAN 2.2 tops out around 81 frames of native context, so any longer video is segments bolted together - and the bolt is the problem. If the next segment starts from a frozen frame with no motion memory, you get a visible jump every single time. IAMCCS_MotionBridgeSave writes the state that fixes that: it takes the tail of your finished segment's latents and the last frame, and saves them to disk as a "motion bridge" your next workflow can load.

    It's the save-side of the pair with IAMCCS_MotionBridgeLoad, and it's an output node - meaning it ends a branch, saves, and passes nothing onward. This is deliberate: it's meant to sit at the end of segment N's workflow, producing the hand-off file for segment N+1.

    How it works

    Give it the latent from your segment's decode/sample path and the matching images, and it does three things:

    1. Slices tail_frames latent frames off the end of latent - those carry the motion state the next segment needs as its motion reference.
    2. Saves everything as output/motion_bridges/<name>.safetensors.
    3. Optionally saves <name>_lastframe.png, the junction frame, for visual inspection and as a fallback LoadImage source.

    The flush_vram toggle (default on) moves the input tensors to CPU and calls ComfyUI's soft empty cache plus torch.cuda.empty_cache() after saving - a real courtesy on tight cards, where one more KSampler OOM right after a save is the classic way a long run dies. Turn it off only if a GPU branch runs immediately after this node and needs the tensors resident.

    Inputs and outputs

    • latent (LATENT) - required, the segment's latents.
    • images (IMAGE) - required, the decoded frames.
    • name (STRING, default segment_bridge) - filename without extension. The tooltip suggests descriptive names like scene01_seg2_to_seg3; follow it, because six bridges named segment_bridge is how you lose an afternoon.
    • tail_frames (INT, default 2) - how many latent frames to slice. Must match motion_latent_count on the next workflow's WanImageMotion-style node.
    • save_preview_png (BOOLEAN, default true) - save the last frame as a PNG alongside.
    • flush_vram (BOOLEAN, default true) - free CUDA memory after saving.

    Outputs: none. It's a terminal node.

    How to install

    Ships in IAMCCS-nodes. ComfyUI Manager search "IAMCCS", or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/IAMCCS/IAMCCS-nodes.git
    

    Restart. No model downloads. Pack floors: ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8.

    Gotchas

    The contract that matters is tail_frames: the number you slice here has to equal the motion_latent_count your next segment's motion node expects, or the continuity logic reads the wrong amount of tail and the seam drifts. If you change one, change the other. And remember the load-side tooltip's warning applies in reverse - newly saved bridges don't appear in the load dropdown until the ComfyUI page is refreshed. Also, this saves only motion/latent state, not character identity; for long-form where faces drift across segments, that's still on you (the Wan community's usual answer is a character LoRA plus the FF/LF anchoring this pack made popular).

    CategoryIAMCCS/Wan

    Inputs (6)

    NameTypeDefaultDescription
    latentLATENT
    imagesIMAGE
    nameSTRINGsegment_bridgeBridge file name (no extension). Use descriptive names like 'scene01_seg2_to_seg3'. Saved to output/motion_bridges/<name>.safetensors
    tail_framesINT21–16How many latent frames to slice from the tail of 'latent'. Must match 'motion_latent_count' on WanImageMotion* in the next workflow.
    save_preview_pngBOOLEANtrueAlso save the last frame as <name>_lastframe.png alongside the .safetensors. Useful for visual inspection and as a fallback LoadImage source.
    flush_vramBOOLEANtrueAfter saving, move input tensors to CPU and call ComfyUI soft_empty_cache + torch.cuda.empty_cache(). Frees CUDA reserved blocks before the next KSampler runs. Disable only if you need the tensors to stay on GPU for another branch that runs immediately after this node.

    Outputs (0)

    No outputs