Nodes/ComfyUI-MaxedOut/WAN 2.2 First & Last I2V MXD
ComfyUI Node

WAN 2.2 First & Last I2V MXD

Pin the first AND last frame of your WAN 2.2 clip

By Maxed-Out-99·Created about a year ago·Updated 21 days ago· 9
WAN 2.2 First & Last I2V MXD
  • positive
  • negative
  • vae
  • start_image
  • end_image
  • positive
  • negative
  • latent
length81
batch_size1

Regular WAN 2.2 image-to-video anchors your clip to a start frame and lets everything after be free. Sometimes that's not enough - you have a specific opening shot and a specific ending shot, and you want the model to fill the middle so it lands exactly where you need it to end. That's the whole trick of WAN 2.2 First & Last I2V MXD: it bakes both boundary frames into the conditioning and only frees the frames between them.

Where it fits

This is one of the Patreon-workflow helpers Maxed-Out-99 ships for WAN 2.2, and it slots into an image-to-video graph the same way the pack's plain Wan22ImageToVideoMXD does - but instead of one start_image, it takes start_image and end_image. You bring your own conditioning (positive/negative from a CLIP + WAN text encoder), a VAE, a length, and the two boundary images, and you get back ready-to-sample positive/negative conditioning plus an empty latent.

How the mechanism works

Under the hood it builds the same concat_latent_image / concat_mask pair that WAN's I2V conditioning uses, with one difference that matters: the known frames are pinned at both ends of the clip, and the mask is folded at full frame rate so only the middle is freed for the model to invent.

Concretely, it:

  1. Allocates an empty latent at [batch, vae.latent_channels, t, h//scale, w//scale] where t = (length-1)//4 + 1 - the 4x temporal compression WAN uses.
  2. Builds a placeholder clip filled with neutral grey, writes your start_image into the front and end_image into the back.
  3. Encodes that whole clip with your VAE and sets concat_mask to zero out just the fixed frames, freeing everything in between.

The two inputs are optional as long as you provide at least one - but the node only earns its name if you give it both. Note the package assumes your images are already pre-sized to a valid WAN bucket: it does no scaling of its own, so run your source frames through the pack's Video Prep / Image Scaler nodes first.

Inputs worth knowing

  • length - total clip length in frames, default 81 (that's 5 seconds at 16fps). Step of 4 because of WAN's 4x temporal latent compression.
  • start_image / end_image - the boundary frames, as IMAGE tensors.
  • vae - your WAN VAE; needed for both encoding and to read the latent channel count.

Outputs are positive, negative (conditioning), and latent - wire all three into a WAN 2.2 sampler.

Install and the comfy_api catch

cd ComfyUI/custom_nodes
git clone https://github.com/Maxed-Out-99/ComfyUI-MaxedOut.git

Restart, or install via Manager (search "Maxed Out"). Same caveat as the other WAN I2V nodes in this pack: these only register when ComfyUI's comfy_api (Nodes 2.0) layer is present. On an older ComfyUI the node won't show up at all - update ComfyUI first.

Troubleshooting

  • "at least one of start_image / end_image must be provided" - the guard for passing neither. Give it one or both.
  • "already pre-sized" mismatch errors - the node reads spatial dimensions from your start_image and assumes the end image matches. If the two frames differ in size you'll get shape errors or a corrupted clip. Run both through the same scaler.
  • Ugly mid-clip jumps - if the middle content fights the two pinned ends, shorten length or pick boundary frames that are closer in style. WAN has to reconcile everything between them.

First-and-last pinning is one of those video tricks that looks like magic when it works - this node makes it a two-wire setup instead of a conditioning surgery session.

Categoryconditioning/video_models

Inputs (7)

NameTypeDefaultDescription
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
lengthINT811–16384
batch_sizeINT11–4096
start_imageoptIMAGE
end_imageoptIMAGE

Outputs (3)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT