> ## 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.

# WanAnimateToVideo - ComfyUI Built-in Node Documentation

> WanAnimateToVideo prepares conditioning data and an initial latent for generating animated videos with Wan, using inputs such as a reference image, pose, face, background, and opti

WanAnimateToVideo prepares conditioning data and an initial latent for generating animated videos with Wan, using inputs such as a reference image, pose, face, background, and optional motion from a previous chunk. It also supports generating longer videos in chunks by reading and updating a `video_frame_offset` value. This node is marked as experimental.

## Inputs

| Parameter | Description | Data Type | Required | Range |
| - | - | - | - | - |
| `positive` | Positive conditioning for guiding the generation towards desired content. | CONDITIONING | Yes | - |
| `negative` | Negative conditioning for steering the generation away from unwanted content. | CONDITIONING | Yes | - |
| `vae` | VAE model used for encoding image and video inputs 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 to generate (default: 77, step: 4). | INT | Yes | 1 to MAX\_RESOLUTION |
| `batch_size` | Number of videos to generate in one batch (default: 1). | INT | Yes | 1 to 4096 |
| `clip_vision_output` | Optional CLIP vision output added to both positive and negative conditioning. | CLIP\_VISION\_OUTPUT | No | - |
| `reference_image` | Reference image used as the appearance starting point for the generated video. If not provided, a black image is used. | IMAGE | No | - |
| `face_video` | Video input providing facial expression guidance. It is resized to 512x512 and scaled to the range -1.0 to 1.0 internally. | IMAGE | No | - |
| `pose_video` | Video input providing pose and motion guidance. | IMAGE | No | - |
| `continue_motion_max_frames` | Maximum number of frames carried over from a previous motion sequence (default: 5, step: 4). | INT | Yes | 1 to MAX\_RESOLUTION |
| `background_video` | Background video used to fill the non-character parts of the frames. | IMAGE | No | - |
| `character_mask` | Mask defining character regions, used to separate the character from the background. | MASK | No | - |
| `continue_motion` | Previous motion frames to continue from, keeping temporal consistency with earlier generated chunks. | IMAGE | No | - |
| `video_frame_offset` | The amount of frames to seek in all the input videos. Used for generating longer videos by chunk. Connect to the video\_frame\_offset output of the previous node for extending a video. (default: 0, step: 1) | INT | Yes | 0 to MAX\_RESOLUTION |

**Parameter Constraints:**

* When `continue_motion` is provided, only its last `continue_motion_max_frames` frames are used.
* Input videos (`face_video`, `pose_video`, `background_video`, `character_mask`) are offset by `video_frame_offset` before use. If the offset is greater than or equal to the input's frame count, that input is ignored, except for a single-frame `character_mask`.
* If `character_mask` has only one frame, that frame is repeated for every frame of the output.
* When `pose_video` is shorter than `length`, its last frame is repeated to fill the remaining frames; the output length is not changed.
* If `clip_vision_output` is provided, it is added to both positive and negative conditioning.
* If `reference_image` is not provided, a black image (all zero values) is used as the default reference.
* If `continue_motion` is not provided, the initial motion frames are filled with constant gray (0.5 intensity) frames.
* When `continue_motion` is used, `video_frame_offset` is reduced by the number of carried-over frames before the next chunk offset is calculated, so overlapping frames are not processed twice.
* `background_video` fills the motion frames after the reference-motion portion; it does not replace the reference image or the carried-over `continue_motion` frames.

## Outputs

| Output Name | Description | Data Type |
| - | - | - |
| `positive` | Modified positive conditioning with additional video context, including CLIP vision output, pose video latent, face video pixels, concatenated latent image, and concatenated mask. | CONDITIONING |
| `negative` | Modified negative conditioning with additional video context, including CLIP vision output, pose video latent, blank face pixels, concatenated latent image, and concatenated mask. | CONDITIONING |
| `latent` | Initial latent tensor (all zero samples) for the generated video, with the shape `[batch_size, 16, latent_length + trim_latent, latent_height, latent_width]`. | LATENT |
| `trim_latent` | Number of latent frames to trim from the beginning of the latent, corresponding to the reference image frames. | INT |
| `trim_image` | Number of image frames to trim from the beginning, corresponding to the reference motion frames. | INT |
| `video_frame_offset` | Updated frame offset to use for the next chunk, based on the input offset and the number of frames processed. | INT |

> 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/WanAnimateToVideo/en.md)

***

**Source fingerprint (SHA-256):** `a95bae4c7ae4ddc8a95bc9dafa2ca920b1d2166802615189537dce16949bfc03`
