Nodes/ComfyUI-WanKeyframeBuilder/Wan Keyframe Builder (Continuation)
ComfyUI Node

Wan Keyframe Builder (Continuation)

Chained Wan shots that don't restart from nothing

By ckinpdx·Created 9 months ago·Updated 9 months ago· 6
Wan Keyframe Builder (Continuation)
  • image1
  • image2
  • image3
  • image4
  • image5
  • image6
  • image7
  • image8
  • continuation_image
  • images
  • masks
  • keyframes
  • svi_reference_only
  • svi_keyframe_segments
num_frames81
spacing_mode
last_strength1.00
middle_strength0.80
continuation_frames3
continuation_strength_mode
continuation_strength1.00
continuation_strength_start0.80
continuation_strength_end0.20
continuation_decay_rate3.0
place_first_keyframetrue
first_keyframe_strength1.00
frame_240
frame_380
frame_460
frame_580
frame_6100
frame_7120
frame_8140

Wan's native context is roughly 81 frames. Want a longer scene? You chunk it - generate a segment, take its tail, and feed that tail into the next segment so the second clip starts mid-motion instead of from a fresh frozen frame. That's the classic continuation trick, and this node is the version of WanKeyframeBuilder purpose-built for it. Where its little sibling builds one shot from keyframes alone, this one takes frames from your previous generation, lays them down at the start of the timeline as motion context, then places your reference image and keyframes after them.

The mechanism is worth understanding because it changed under you: continuation frames now sit in chronological order - position 0 is the oldest, position N−1 is the newest. Earlier versions reversed them; that logic was removed, so any workflow you built on the old ordering will silently produce wrong transitions. The node takes the last continuation_frames from whatever you feed into continuation_image, resizes them to match your keyframe resolution if needed, and fills positions 0..N−1. Then image1 is placed immediately after the continuation (or at frame 0 if there's no continuation - controlled by place_first_keyframe), and image2image8 distribute across the remaining timeline under even or manual spacing.

The inputs that matter

  • image1: required, and it's special. It's your reference image - placed on the timeline and used as the base for the experimental SVI outputs. image2image8 are the real timeline keyframes.
  • continuation_image + continuation_frames: the tail of your previous video, default 3 frames (max 64). The node only ever uses continuation_frames frames from the end of whatever you feed it, so feeding it a longer clip is fine - it grabs the newest slice.
  • continuation_strength_mode: uniform pins every continuation frame at continuation_strength (default 1.0). decay ramps them with an exponential curve from continuation_strength_start (0.8) down to continuation_strength_end (0.2), with continuation_decay_rate controlling how sharp the drop is - 3.0 moderate, 5.0+ aggressive. The decay idea: earlier frames have more context to hand over, so let them lock harder and loosen toward the seam.
  • place_first_keyframe and first_keyframe_strength: whether image1 goes on the timeline at all, and how hard it locks (default 1.0).
  • middle_strength / last_strength: same semantics as the base node - 0.8 default for middles, 1.0 for the last keyframe.

Note there's no frame_1 here - the manual frame_2frame_8 positions only arrange the timeline keyframes; image1's spot is determined by the continuation.

Outputs - and the experimental ones

images, masks, and keyframes work like the base node (keyframes here is image1 + all connected image2–8, handy for HuMo/multi-reference encoders). Then there are two extra outputs: svi_reference_only (timeline padded entirely with image1) and svi_keyframe_segments (each keyframe fills an equal slice of the timeline). Those are aimed at Stable Video Infinity 2.0 LoRA workflows - and the README is refreshingly blunt that they're experimental and NOT confirmed to work with SVI LoRAs in Kijai's wrapper. Treat them as a sandbox, not a recipe.

Installing and running it

Same pack as the base node - Manager, or:

cd ComfyUI/custom_nodes
git clone https://github.com/ckinpdx/ComfyUI-WanKeyframeBuilder
# restart ComfyUI

No extra dependencies, no model downloads. For a two-segment clip: segment 1 uses this node with no continuation_image, you generate 81 frames, then feed that clip's tail into continuation_image for segment 2. One real gotcha beyond the ordering change: image1 and image2–8 must all match resolution (the node raises an error on mismatch), and num_frames should stay on the 4n+1 pattern - 81, 121, 161. If your seam looks like a hard cut, drop first_keyframe_strength or loosen the decay end so the model isn't locked to an image the previous segment never produced.

CategoryWanKeyframeBuilder

Inputs (28)

NameTypeDefaultDescription
image1IMAGEFirst reference image. Placed on the timeline and used for SVI/reference.
num_framesINT811–4096Total frames in the output timeline. Should be 4n+1 (e.g., 81, 121, 161) for Wan models.
spacing_modeCOMBOEven: auto-distribute keyframes. Manual: use frame position inputs.
last_strengthFLOAT1.000–1Mask strength for the LAST keyframe. 1.0 = fully locked.
middle_strengthFLOAT0.800–1Mask strength for middle keyframes.
continuation_framesINT31–64Number of frames to use from continuation input (taken from END of previous video).
continuation_strength_modeCOMBOUniform: all continuation frames use same strength. Decay: exponential decay from start to end.
continuation_strengthFLOAT1.000–1Strength for continuation frames (uniform mode).
continuation_strength_startFLOAT0.800–1Starting strength for first continuation frame (decay mode).
continuation_strength_endFLOAT0.200–1Ending strength for last continuation frame (decay mode).
continuation_decay_rateFLOAT3.00.1–10Exponential decay rate. Higher = sharper drop. 3.0 = moderate, 5.0+ = aggressive.
place_first_keyframeBOOLEANtruePlace image1 on the timeline (after continuation if present, otherwise at frame 0).
first_keyframe_strengthFLOAT1.000–1Mask strength for image1 wherever it is placed.
frame_2INT400–4095Position for keyframe 2 (used in manual mode)
frame_3INT800–4095Position for keyframe 3 (used in manual mode)
frame_4INT600–4095Position for keyframe 4 (used in manual mode)
frame_5INT800–4095Position for keyframe 5 (used in manual mode)
frame_6INT1000–4095Position for keyframe 6 (used in manual mode)
frame_7INT1200–4095Position for keyframe 7 (used in manual mode)
frame_8INT1400–4095Position for keyframe 8 (used in manual mode)
image2optIMAGE
image3optIMAGE
image4optIMAGE
image5optIMAGE
image6optIMAGE
image7optIMAGE
image8optIMAGE
continuation_imageoptIMAGEFrames from previous generation. Last N frames will be used for motion context.

Outputs (5)

NameTypeDescription
imagesIMAGE
masksMASK
keyframesIMAGE
svi_reference_onlyIMAGE
svi_keyframe_segmentsIMAGE