Nodes/ComfyUI/WanFirstLastFrameToVideo
ComfyUI Node Runs on cloud

WanFirstLastFrameToVideo

Two keyframes, an 81-frame movie in between

By Comfy-Org·Created 4 years ago·Updated about an hour ago· 129,964
WanFirstLastFrameToVideo
  • positive
  • negative
  • vae
  • clip_vision_start_image
  • clip_vision_end_image
  • start_image
  • end_image
  • positive
  • negative
  • latent
width832
height480
length81
batch_size1

WanFirstLastFrameToVideo is the "animate between two photos" node for Wan. Give it a start image, optionally an end image, and it builds the conditioning plus the empty latent for a clip that opens on the first frame and lands on the second. It's the base of the whole first/last-frame family in ComfyUI - Wan Fun Inpaint is literally this node called with a CLIP vision input bolted on.

If your ask is "I have the beginning and the end, invent the middle," this is the node. It's the same family of idea as Wan Image-to-Video (which conditions on one image), but with both bookends the model knows the destination, which makes loops, morphs, and "character walks from here to there" clips far more predictable.

How it works

The mechanism is elegant and worth knowing because it explains every failure mode. Both images get upscaled to your target size and VAE-encoded. Then the node builds a full-length canvas of mid-gray, pastes the start image into the first frames and the end image into the last frames, and encodes the whole thing. The attached concat_mask zeros out the frames the images occupy - plus a few extra frames of slack - telling the sampler: these frames are fixed, denoise everything between them. That's why the motion starts a beat after frame one and settles before the end: the "blend zone" is baked into the mask.

Inputs:

  • start_image / end_image - your keyframes. Both optional; one bookend is allowed, two is the real feature.
  • clip_vision_start_image / clip_vision_end_image - optional CLIP vision features for each bookend. This is where identity conditioning enters; leave them out and the model has only pixels to go on.
  • width / height / length / batch_size - the canvas, length defaulting to Wan's native 81 frames.

Outputs: positive, negative, and latent (the empty latent for the KSampler).

Where people get burned

  • No identity anchoring. Without a CLIP vision encode on your images, the model often "forgets" the subject mid-clip - it has pixels but no semantic anchor. The FunInpaint variant exists precisely because it forces the start-image vision conditioning.
  • Aspect mismatch. Images are resized to width×height; very different aspect ratios crop unexpectedly. Generate or pre-crop your keyframes near your target AR.
  • The blend zone. Because the mask zeros a few extra frames around each image, the visible motion starts slightly late. Don't expect frame 1 to be literally identical to your start image after a full decode - keep a couple of filler frames if you're stitching clips.
  • 81-frame ceiling. Native context is 81 frames; beyond that, quality degrades or you loop. Extend with the chunking/extension tools instead of pushing length.

Ships with ComfyUI core (comfy_extras/nodes_wan.py), needs a Wan image-to-video family checkpoint. For the price of two frames and a prompt, it's the closest thing video conditioning has to a "no-brainer."

Categorymodel/conditioning/wan

Inputs (11)

NameTypeDefaultDescription
positiveCONDITIONING
negativeCONDITIONING
vaeVAE
widthINT83216–16384
heightINT48016–16384
lengthINT811–16384
batch_sizeINT11–4096
clip_vision_start_imageoptCLIP_VISION_OUTPUT
clip_vision_end_imageoptCLIP_VISION_OUTPUT
start_imageoptIMAGE
end_imageoptIMAGE

Outputs (3)

NameTypeDescription
positiveCONDITIONING
negativeCONDITIONING
latentLATENT