WAN Connect Frames
Sew two WAN clips together without breaking the 4n+1 rule
- section_1_frames
- section_2_frames
- start_frame
- end_frame
- frames
- mask
- cap_info
Wan has a dumb frame-count rule and it will bite you eventually. The VAE compresses time in blocks of four, so a clean length is 1 + 4n - 5, 9, 49, 81, 121. Ask for 111 frames and you can get 109 back, or a sampler that refuses outright. Once you accept that, the real problem is joining two good clips of the same character into one continuous shot: the frame math for the combined thing is never convenient, and the seam between clip A and clip B is exactly where the model loves to smear. WAN Connect Frames is Mister-Link's answer to both.
It builds you a single, Wan-legal sequence out of your footage, marks the transition region so the model regenerates just the seam, and hands you metadata so its partner node can strip the scaffolding afterwards. It's plumbing - unlovely, but the kind that stops you burning a 14B render because the count came out wrong at the last second.
What it actually assembles
You feed it one required clip, section_1_frames. Optionally add a section_2_frames to continue into, plus a start_frame and/or end_frame - single images that get repeated to fill "their share of four removable WAN cap frames". One boundary image means all four go to that end; provide both and they split two and two. Those repeated caps are the trick: Wan needs the total to land on 1 + 4n, and instead of padding with noise or wasted budget, the node pads with held copies of your boundary. They hold the clip still at the entrance and exit, and they get deleted after generation.
In between goes the seam: transition_frames is the number of pure white frames dropped between the sections, which become the hand-off region the model has to invent. That's the whole job of the second output, mask: black for your real footage, white for the connection frames. Feed that mask into a Wan video-inpaint/regenerate pass and the model redraws only the white gap into a plausible transition while your clips survive untouched.
The inputs you'll actually set
- section_1_frames - the first clip. Required.
- section_2_frames or end_frame - you need at least one of these or it refuses to run.
- transition_frames - how many white frames in the seam. Default 0.
- preference -
same frame count(default) keeps the requested total by trimming source frames when it can;add framesnever trims, just rounds the total up.
Everything must be the same resolution and channel count, and the outputs are frames, mask, and a cap_info STRING - JSON that records exactly which frame indices are scaffolding to strip later. Keep that string threaded through your graph and connected to WAN Remove Cap Frames after the decode; it's the bookkeeping that makes the whole two-node dance work.
Where people get burned
Don't touch anything upstream of Connect between running it and running Remove. cap_info stores absolute frame indices computed from what you fed in - change transition_frames or add frames to a section afterwards and the cleanup node will error out on a count mismatch. Plan the whole pass before you run Connect.
It's also worth being honest about scope: this is a video-to-video join tool for people stitching multi-clip Wan shots with masked regeneration, not a node you'll use for every generation. If you just want one long clip, the ecosystem's chunk-and-stitch nodes or VACE extension are the mainstream path; this is the DIY join where you keep control of the exact seam.
Installing it
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
…or search Link Comfy Nodes in ComfyUI Manager, then restart. The pair needs only torch and numpy on top of ComfyUI's stack, but the pack's requirements.txt drags in heavy siblings (transformers, numba, pytorch_lightning, a CLIP git build) regardless. No model downloads. And remember the README's warning: the author changes behavior "without warning," so pin a version you're happy with.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| section_1_frames | IMAGE | Required first sequence. Supply only the frames you want to keep. | |
| transition_frames | INT | 00–9999 | Number of white frames to use for transitions between sections. Same-frame-count mode may trim source frames to preserve the requested total. |
| preference | COMBO | same frame count | Keep the requested core frame count when possible, or always round it up by adding frames. |
| section_2_framesopt | IMAGE | Optional second sequence. Either provide this or end_frame. | |
| start_frameopt | IMAGE | Optional leading cap image. It is repeated to fill its share of four removable WAN cap frames. | |
| end_frameopt | IMAGE | Optional trailing cap image. It is repeated to fill its share of four removable WAN cap frames. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | Optional start, section 1, white connection frames, section 2, and optional end frames. |
| mask | MASK | One mask per frame: black for supplied images and white for connection frames. |
| cap_info | STRING | Metadata for WAN Remove Cap Frames; connect this output to its cap_info input. |