WAN Begin + End Frames
Pin both ends of your Wan video and let the model fill the seam
- begin_frames
- end_frames
- frames
- mask
You've got two Wan clips you want to be one clip - the lead-in and lead-out of a seamless loop, or two takes you want stitched together with the model generating a smooth transition in the gap. Wan 2.1/2.2, still the open video base most local setups run, can absolutely do that, but it wants two things handed to it: the full frame stack to condition on, and a mask that says keep these frames, regenerate these frames. Building that by hand is fiddly, which is where WAN Begin + End Frames comes in. It takes your begin and end clips, trims them to taste, glues a white placeholder gap between them, and hands back the frames plus a mask marking the gap as the part to regenerate.
What it actually does
Wan's causal VAE downsamples time by four, so any clip you generate has to come out as a "Wan-valid" count: 4k+1 frames - 1, 5, 9, 13, and so on. Ask for 12 and you're getting 9 or 13 whether you like it or not. The stock conditioning nodes in ComfyUI (the first/last-frame-to-video pattern) hide all this by deriving the mask from how many start and end frames you feed in. This node is the DIY, in-your-control version: it solves the same rounding problem and produces the sequence explicitly.
Mechanically it's dead simple under the hood - pure tensor slicing, no model involved. Feed it begin_frames (a single image or a whole clip) and optional end_frames, it trims video_1_end_cut frames off the tail of clip 1 and video_2_start_cut off the head of clip 2, drops frames_to_add_between solid-white placeholders in the middle, then rounds the total to the nearest Wan-valid count. Rounding down means extra cuts taken evenly from both clips; rounding up means the white gap grows. The preference dropdown (balanced, add frames, remove frames) just picks which way it leans - on a tie it adds frames, because that preserves your source footage.
The inputs and outputs that matter
Most of this is set-and-forget. The knobs you'll actually touch:
begin_framesand optionalend_frames- both take IMAGE batches. They must match in height, width, and channels, or the node throws. Resize before you get here.frames_to_add_between- how many frames of fresh motion you want in the seam. This is the number that drives everything else.preference- leave it onbalanceduntil you have a reason not to.
The two outputs are the whole point: frames (begin frames, then white replacements, then end frames, in order) and mask (one frame-per-mask, black where preserved, white where the model should regenerate). frames feeds the conditioning/context input of your Wan I2V or VACE pipeline; mask feeds the inpaint mask input that tells the sampler which region to denoise. If you're on a stock node that derives the mask itself from frame counts, you mostly need the frames side - the explicit mask output is what you reach for in masked-sampler flows.
Installing it
ComfyUI Manager is the easy path - search "Link Comfy Nodes" (the pack title) and install. Or by hand:
cd ComfyUI/custom_nodes
git clone https://github.com/Mister-Link/link-comfy-nodes
Then restart ComfyUI. There are no model downloads for this node - it operates on frames you already generated or loaded. One heads-up though: installing the pack drags in its whole dependency list (transformers, pytorch_lightning, mambapy, even OpenAI's CLIP built from git) because it ships ~40 other nodes for sprite work, matting, pose, and so on. Manager handles that fine, but expect a chunky first install for what is otherwise a couple of tensor ops.
Where people get burned
The rounding is invisible, and it's the #1 surprise. You size things for a 12-frame total and get 13 (extra white frames) or 9 (extra cuts off your source clips). That's not a bug - it's Wan's constraint surfacing. If the extra cut bothers you, that's what add frames is for.
Two more real ones. If you wire end_frames in, the node refuses to go below a 5-frame total - one kept frame each side means at least three frames of generated motion in between, even if you asked for none. Want just a lead-in with no end anchor? Leave end_frames disconnected. And cuts are clamped so each source clip always keeps at least one frame - asking to delete all of clip 1 won't empty it, it'll silently keep one.
Finally, temper expectations on stability. This is a one-person pack whose README literally reads "I change how nodes behave without warning." It's a sharp little tool for a niche move, but don't build a production workflow you can't afford to re-tune after an update.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| begin_frames | IMAGE | Video 1. Frames kept at the beginning; requested cuts are taken from its end. | |
| video_1_end_cut | INT | 00–9999 | Desired number of frames to remove from the end of video 1. |
| video_2_start_cut | INT | 00–9999 | Desired number of frames to remove from the beginning of video 2. |
| frames_to_add_between | INT | 00–9999 | Desired number of white replacement frames between video 1 and video 2. |
| preference | COMBO | balanced | Whether WAN rounding should prefer more white frames or more cuts. |
| end_framesopt | IMAGE | Optional video 2. Frames kept at the end; requested cuts are taken from its beginning. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| frames | IMAGE | Begin frames, white replacement frames, and end frames in order. |
| mask | MASK | One mask per frame: black for preserved images and white for replacement frames. |