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

# CosmosPredict2ImageToVideoLatent - ComfyUI Built-in Node Documentation

> Creates video latents for the Cosmos Predict2 image-to-video workflow.

Creates video latents for the Cosmos Predict2 image-to-video workflow. The node can produce an empty video latent of a given size and length, or insert encoded start and/or end images into the sequence so those frames are kept during generation. Any supplied image is resized to the requested `width` and `height` and encoded with the provided VAE before being placed at the beginning and/or end of the latent sequence.

## Inputs

| Parameter     | Description                                                                   | Data Type | Required | Range                 |
| ------------- | ----------------------------------------------------------------------------- | --------- | -------- | --------------------- |
| `vae`         | The VAE model used to encode the start and end images into latent space       | VAE       | Yes      | -                     |
| `width`       | Width of the output video in pixels (default: 848, must be a multiple of 16)  | INT       | Yes      | 16 to MAX\_RESOLUTION |
| `height`      | Height of the output video in pixels (default: 480, must be a multiple of 16) | INT       | Yes      | 16 to MAX\_RESOLUTION |
| `length`      | Number of frames in the video sequence (default: 93)                          | INT       | Yes      | 1 to MAX\_RESOLUTION  |
| `batch_size`  | Number of video sequences to generate (default: 1)                            | INT       | Yes      | 1 to 4096             |
| `start_image` | Optional starting image for the video sequence                                | IMAGE     | No       | -                     |
| `end_image`   | Optional ending image for the video sequence                                  | IMAGE     | No       | -                     |

**Note:** When neither `start_image` nor `end_image` is provided, the node simply returns an empty latent of the requested size and length. When one or both images are provided, they are resized to `width` and `height`, encoded with the `vae`, and placed at the beginning and/or end of the latent sequence. The corresponding regions are marked in the noise mask so they are preserved during generation. The encoded latents are converted with the Wan 2.1 latent format, and the resulting latent and mask are repeated `batch_size` times.

## Outputs

| Output Name | Description                                                                                                                                                                                                                  | Data Type |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| `LATENT`    | The generated video latent containing `samples` (the video latent sequence) and, when at least one of `start_image` or `end_image` is provided, a `noise_mask` marking the frames that should be preserved during generation | 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/CosmosPredict2ImageToVideoLatent/en.md)

***

**Source fingerprint (SHA-256):** `842bd2b8cda438e7b938439d4eba280478939e3302dc1846d52595d40082ff05`
