Nodes/VACE Automation/VACE Final Loop Prep
ComfyUI Node

VACE Final Loop Prep

Turn one clip into a seamless loop

By EnviralDesign·Created 6 months ago·Updated 3 months ago· 0
VACE Final Loop Prep
  • video
  • control_video
  • control_mask
  • loop_body
  • width
  • height
  • length
  • context_frames
  • replace_frames
  • new_frames
context_frames8
replace_frames8
new_frames0
debugfalse

Making a seamless loop used to be the one thing AnimateDiff held over Wan. It isn't anymore - you generate a tail-to-head transition and stitch it into a loop, and VACE Final Loop Prep is the node that builds the control window for that transition from a single clip. It's the "loop a clip back on itself" version of VACE Join Prep, which is the two-clip version.

How it works

Give it one IMAGE clip (your video as frames). It takes the tail of the clip and the head of the clip, packs them around a gray filler block, and hands you a control_video + control_mask that tells VACE "regenerate this middle stretch, using the tail on one side and the head on the other as guidance." The model effectively has to produce a transition from the clip's last moments back into its first moments - which, stitched together, is a loop.

The layout mirrors VACE Join Prep: control_video = tail context + gray filler + head context, and the control_mask is ones only across the filler (the area to regenerate). Three numbers shape it:

  • context_frames (default 8) - how many real frames on each side anchor the transition
  • replace_frames (default 8) - how many frames at the tail/head get replaced by generated content
  • new_frames (default 0) - extra generated frames on top, if you want the loop to breathe

The node also carves out loop_body - the middle of the clip with context + replace frames trimmed off each end - which becomes the "original" part of the loop.

Inputs and outputs that matter

Inputs: video (IMAGE), the three numbers above, and debug. Outputs: control_video + control_mask (into your VACE control nodes), loop_body (into VACE Final Loop Assemble), plus width, height, length and echoed copies of the three frame-count params for wiring into samplers and other bookkeeping.

Installing it

Part of the comfy-vace-automation pack, no extra pip dependencies:

cd ComfyUI/custom_nodes
git clone https://github.com/EnviralDesign/comfy-vace-automation

Restart ComfyUI, or install via ComfyUI Manager (search "comfy-vace-automation").

When it bites you

  • Clip too short. The node requires at least 2 × (context_frames + replace_frames) + 1 frames - it needs enough real footage to anchor both sides and leave a middle. A 33-frame clip with default settings will error. Use a longer source clip or shrink the context/replace numbers.
  • Dimensions not divisible by 16. Same rule as every Wan pipeline: VACE control wants multiples of 16. Resize before you get here.
  • A "loop" that's mostly transition. If context_frames and replace_frames are large relative to the clip, loop_body shrinks toward nothing and the result is a transition pretending to be a loop. Keep context + replace comfortably smaller than half the clip.

The final-loop path in this pack is meant to be the last pass of a longer join - the README describes it as "one final tail-to-head loop pass after the last normal seam." So don't read this as a standalone loop maker so much as the capstone that closes a multi-clip project back into itself.

Categoryvideo/VACE

Inputs (5)

NameTypeDefaultDescription
videoIMAGE
context_framesINT81–4096
replace_framesINT80–4096
new_framesINT00–4096
debugBOOLEANfalse

Outputs (9)

NameTypeDescription
control_videoIMAGE
control_maskMASK
loop_bodyIMAGE
widthINT
heightINT
lengthINT
context_framesINT
replace_framesINT
new_framesINT