> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# WanFirstLastFrameToVideo - ComfyUI Built-in Node Documentation

> The WanFirstLastFrameToVideo node prepares conditioning for video generation by combining a start frame and an end frame with text prompts.

The WanFirstLastFrameToVideo node prepares conditioning for video generation by combining a start frame and an end frame with text prompts. It encodes the frame images into latent space, creates a mask that tells the video model which frames are already known, and attaches CLIP vision features when they are provided. The node outputs updated positive and negative conditioning plus an empty latent that defines the size and length of the video to generate.

## Inputs

| Parameter                 | Description                                                                                                                              | Data Type            | Required | Range                 |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------- | --------------------- |
| `positive`                | Positive text conditioning used to guide the video generation.                                                                           | CONDITIONING         | Yes      | -                     |
| `negative`                | Negative text conditioning used to guide the video generation.                                                                           | CONDITIONING         | Yes      | -                     |
| `vae`                     | VAE model used to encode the combined frame images into latent space.                                                                    | VAE                  | Yes      | -                     |
| `width`                   | Width of the generated video in pixels (default: 832, step: 16).                                                                         | INT                  | Yes      | 16 to MAX\_RESOLUTION |
| `height`                  | Height of the generated video in pixels (default: 480, step: 16).                                                                        | INT                  | Yes      | 16 to MAX\_RESOLUTION |
| `length`                  | Number of frames in the video sequence (default: 81, step: 4).                                                                           | INT                  | Yes      | 1 to MAX\_RESOLUTION  |
| `batch_size`              | Number of videos to generate at once (default: 1).                                                                                       | INT                  | Yes      | 1 to 4096             |
| `clip_vision_start_image` | CLIP vision features extracted from the start image. If both start and end CLIP vision inputs are provided, their features are combined. | CLIP\_VISION\_OUTPUT | No       | -                     |
| `clip_vision_end_image`   | CLIP vision features extracted from the end image. If both start and end CLIP vision inputs are provided, their features are combined.   | CLIP\_VISION\_OUTPUT | No       | -                     |
| `start_image`             | Starting frame image for the video sequence. Its first `length` frames are used and resized to `width` × `height`.                       | IMAGE                | No       | -                     |
| `end_image`               | Ending frame image for the video sequence. Its last `length` frames are used and resized to `width` × `height`.                          | IMAGE                | No       | -                     |

**Note:** When at least one of `start_image` or `end_image` is provided, the node builds a combined frame sequence where the start and end frames are filled in and the remaining frames use a neutral gray placeholder (0.5). A mask marks the filled regions as known and the placeholder regions as unknown, allowing the video model to generate the in-between frames. When a start image is provided, the known region also extends 3 extra frames beyond the image. The same encoded frame image and mask are attached to both `positive` and `negative` conditioning. If both CLIP vision inputs are provided, their hidden states are concatenated; if only one is provided, it is used on its own. The latent video length is derived from `length` after temporal compression: `((length - 1) // 4) + 1`.

## Outputs

| Output Name | Description                                                                                                | Data Type    |
| ----------- | ---------------------------------------------------------------------------------------------------------- | ------------ |
| `positive`  | Positive conditioning with the encoded frame image, mask, and (if provided) CLIP vision features attached. | CONDITIONING |
| `negative`  | Negative conditioning with the encoded frame image, mask, and (if provided) CLIP vision features attached. | CONDITIONING |
| `latent`    | Empty latent tensor (all zeros) shaped for the given batch size, video length, and resolution.             | LATENT       |

> This documentation was AI-generated. If you find any errors or have suggestions for improvement, please feel free to contribute! [Edit on GitHub](https://github.com/Comfy-Org/embedded-docs/blob/main/comfyui_embedded_docs/docs/WanFirstLastFrameToVideo/en.md)

***

**Source fingerprint (SHA-256):** `0072e441cb80334c3c961d1bbf2d081c78bc38ed1eacca840c577a2d01b36f05`
