WanVideo Encode
Turn images into Wan latents for I2V and V2V
- vae
- image
- mask
- samples
This is the workhorse you'll wire up in almost every Wan graph that starts from a picture. WanVideoEncode takes an image (or a batch of frames) and runs it through the Wan VAE to produce a latent - the compressed representation the model actually works on. Image-to-video needs it for the start frame. Video-to-video needs it to encode the source clip. And every reference-conditioning node in this pack - Phantom, SCAIL, Lynx - ultimately wants latents, which is what this node makes. If you're feeding pixels into Wan, they pass through here first.
Nothing exotic about it conceptually; it's a VAE encode. But it's the WanVideoWrapper's own encode, matched to the wrapper's WANVAE type and carrying the tiling controls you need when frames get big.
How it works
The VAE compresses your image from pixel space into a much smaller latent space (Wan's VAE also compresses time ~4x, which is why frame counts like to land on the 4n+1 grid). Big frames can blow up VRAM during encode, so the node offers tiling: it chops the image into overlapping tiles, encodes each, and stitches them. That trades a little speed and a small seam risk for the ability to encode high-res frames on a modest card.
The inputs and outputs that matter
vae(WANVAE) - the Wan VAE, loaded by the wrapper's VAE loader. This has to be the Wan VAE specifically, not a generic SD one.image(IMAGE) - what you're encoding: a single start frame, or a batch of frames for V2V.enable_vae_tiling(default false) - flip this on when you run out of VRAM encoding large frames. Off is faster when you can afford it.tile_x/tile_y(default 272) andtile_stride_x/tile_stride_y(144 / 128) - tile size and overlap. The defaults are fine; only touch them if you're chasing a seam or squeezing memory.
Optional but useful: mask (MASK) for inpainting-style encodes where only part of the frame should change, noise_aug_strength (default 0) to add a touch of noise to the encoded latent, and latent_strength (default 1) to scale the latent's influence.
Output is samples (LATENT) - feed it into a sampler, an image-embeds node, or a reference-conditioning node.
How to install it
Part of the WanVideoWrapper. ComfyUI Manager: search ComfyUI-WanVideoWrapper, install, restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt
then restart. You need the Wan VAE file downloaded (it comes with the Wan weight sets, e.g. from huggingface.co/Kijai/WanVideo_comfy) and loaded through the wrapper's VAE loader so this node has a WANVAE to use.
Common issues & troubleshooting
Out-of-memory during encode. Turn on enable_vae_tiling. That's what it's for. If it still OOMs, drop the tile size.
Wrong VAE type. This node wants WANVAE, not a stock ComfyUI VAE. If the input won't connect, you loaded the VAE with the wrong loader - use the WanVideoWrapper's VAE loader.
Visible tile seams. Rare with the defaults, but if you crank the tile size down you can get faint grid seams. Increase the stride overlap or bump the tile size back up. Most people never touch these and never see a seam.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| vae | WANVAE | — | |
| image | IMAGE | — | |
| enable_vae_tiling | BOOLEAN | false | Drastically reduces memory use but may introduce seams |
| tile_x | INT | 27264–2048 | Tile size in pixels, smaller values use less VRAM, may introduce more seams |
| tile_y | INT | 27264–2048 | Tile size in pixels, smaller values use less VRAM, may introduce more seams |
| tile_stride_x | INT | 14432–2048 | Tile stride in pixels, smaller values use less VRAM, may introduce more seams |
| tile_stride_y | INT | 12832–2048 | Tile stride in pixels, smaller values use less VRAM, may introduce more seams |
| noise_aug_strengthopt | FLOAT | 0.0000–10 | Strength of noise augmentation, helpful for leapfusion I2V where some noise can add motion and give sharper results |
| latent_strengthopt | FLOAT | 1.0000–10 | Additional latent multiplier, helpful for leapfusion I2V where lower values allow for more motion |
| maskopt | MASK | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| samples | LATENT | — |