WanVideo Add Extra Latent
Inject extra latents into Wan image embeds
- embeds
- extra_latents
- image_embeds
This is a plumbing node for people building non-standard Wan workflows. It takes an existing set of Wan image embeds and splices additional latents into them at a position you choose. Nothing glamorous on its own - but if you're doing context-window init tricks, keyframe injection, or feeding extra reference frames into an I2V generation, this is how you get those extra latents into the conditioning the sampler actually sees.
You wouldn't reach for it on a vanilla text-to-video or single-image I2V graph. It shows up in the more advanced setups where the "init" isn't one image but a curated set of latent frames placed at specific points in the sequence.
How it works
WanVideoWrapper carries an image-embeds object (WANVIDIMAGE_EMBEDS) that holds the latent conditioning for a generation - think of it as the model's starting information about what frames should look like. This node adds your extra_latents into that object at latent_index, so the extra latent lands at a chosen spot in the frame sequence rather than just being appended blindly. It returns the modified embeds, unchanged except for the insertion.
The inputs and output that matter
embeds(WANVIDIMAGE_EMBEDS, required) - the image embeds you're modifying, from whatever built them (an image-embeds node upstream).extra_latents(LATENT, required) - the latent(s) to inject. Often these come from encoding image(s) with the Wan VAE - for instance a single-frame encode, or the per-frame batch out of WanVideoEncodeLatentBatch.latent_index(INT, default 0, range -1000 to 1000) - where the extra latent goes in the sequence.0is the start; positive indices move it later; negative indices count from the end (so-1-style indexing places it near the tail). This is the knob that matters - get it wrong and your reference frame shows up at the wrong moment.
The output is image_embeds (WANVIDIMAGE_EMBEDS) - feed it onward to the sampler (or the next embed-modifying node).
How to install it
ComfyUI Manager: search ComfyUI-WanVideoWrapper, install, restart. Manually:
cd ComfyUI/custom_nodes
git clone https://github.com/kijai/ComfyUI-WanVideoWrapper
pip install -r ComfyUI-WanVideoWrapper/requirements.txt
then restart. No download of its own.
Common issues & troubleshooting
Off-by-frame placement. The whole point of the node is latent_index, and the Wan VAE compresses time ~4x - so latent indices are not pixel-frame indices. One latent covers roughly four output frames. If your injected content appears at the wrong time, you're almost certainly reasoning in frames when you should be reasoning in latents. Sketch the latent count first, then index into it.
Latent shape mismatch. The extra_latents need to be Wan-VAE latents compatible with the embeds you're inserting into - same channels, sensible spatial size. Latents encoded with a different VAE won't slot in cleanly. Encode with the Wan VAE and keep resolutions consistent.
Nothing visibly changed. If the injected latent's index falls outside the effective sequence, or gets overwritten by a later node in the chain, you won't see it. Check the order of your embed-modifying nodes - they hand WANVIDIMAGE_EMBEDS down a chain, and a later node can clobber what this one added.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| embeds | WANVIDIMAGE_EMBEDS | — | |
| extra_latents | LATENT | — | |
| latent_index | INT | 0-1000–1000 | Index to insert the extra latents at in latent space |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image_embeds | WANVIDIMAGE_EMBEDS | — |