Wan Keyframe Builder (Continuation)
Chained Wan shots that don't restart from nothing
- image1
- image2
- image3
- image4
- image5
- image6
- image7
- image8
- continuation_image
- images
- masks
- keyframes
- svi_reference_only
- svi_keyframe_segments
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 image2–image8 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.image2–image8are the real timeline keyframes.continuation_image+continuation_frames: the tail of your previous video, default 3 frames (max 64). The node only ever usescontinuation_framesframes from the end of whatever you feed it, so feeding it a longer clip is fine - it grabs the newest slice.continuation_strength_mode:uniformpins every continuation frame atcontinuation_strength(default 1.0).decayramps them with an exponential curve fromcontinuation_strength_start(0.8) down tocontinuation_strength_end(0.2), withcontinuation_decay_ratecontrolling 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_keyframeandfirst_keyframe_strength: whetherimage1goes 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_2–frame_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.
Inputs (28)
| Name | Type | Default | Description |
|---|---|---|---|
| image1 | IMAGE | First reference image. Placed on the timeline and used for SVI/reference. | |
| num_frames | INT | 811–4096 | Total frames in the output timeline. Should be 4n+1 (e.g., 81, 121, 161) for Wan models. |
| spacing_mode | COMBO | Even: auto-distribute keyframes. Manual: use frame position inputs. | |
| last_strength | FLOAT | 1.000–1 | Mask strength for the LAST keyframe. 1.0 = fully locked. |
| middle_strength | FLOAT | 0.800–1 | Mask strength for middle keyframes. |
| continuation_frames | INT | 31–64 | Number of frames to use from continuation input (taken from END of previous video). |
| continuation_strength_mode | COMBO | Uniform: all continuation frames use same strength. Decay: exponential decay from start to end. | |
| continuation_strength | FLOAT | 1.000–1 | Strength for continuation frames (uniform mode). |
| continuation_strength_start | FLOAT | 0.800–1 | Starting strength for first continuation frame (decay mode). |
| continuation_strength_end | FLOAT | 0.200–1 | Ending strength for last continuation frame (decay mode). |
| continuation_decay_rate | FLOAT | 3.00.1–10 | Exponential decay rate. Higher = sharper drop. 3.0 = moderate, 5.0+ = aggressive. |
| place_first_keyframe | BOOLEAN | true | Place image1 on the timeline (after continuation if present, otherwise at frame 0). |
| first_keyframe_strength | FLOAT | 1.000–1 | Mask strength for image1 wherever it is placed. |
| frame_2 | INT | 400–4095 | Position for keyframe 2 (used in manual mode) |
| frame_3 | INT | 800–4095 | Position for keyframe 3 (used in manual mode) |
| frame_4 | INT | 600–4095 | Position for keyframe 4 (used in manual mode) |
| frame_5 | INT | 800–4095 | Position for keyframe 5 (used in manual mode) |
| frame_6 | INT | 1000–4095 | Position for keyframe 6 (used in manual mode) |
| frame_7 | INT | 1200–4095 | Position for keyframe 7 (used in manual mode) |
| frame_8 | INT | 1400–4095 | Position for keyframe 8 (used in manual mode) |
| image2opt | IMAGE | — | |
| image3opt | IMAGE | — | |
| image4opt | IMAGE | — | |
| image5opt | IMAGE | — | |
| image6opt | IMAGE | — | |
| image7opt | IMAGE | — | |
| image8opt | IMAGE | — | |
| continuation_imageopt | IMAGE | Frames from previous generation. Last N frames will be used for motion context. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| images | IMAGE | — |
| masks | MASK | — |
| keyframes | IMAGE | — |
| svi_reference_only | IMAGE | — |
| svi_keyframe_segments | IMAGE | — |