Nodes/HunyuanVideo-1.5 nodes/HunyuanVideo VAE Encode
ComfyUI Node

HunyuanVideo VAE Encode

The node that stuffs your reference image into HunyuanVideo 1.5

By yuanyuan-spec·Created 10 months ago·Updated 10 months ago· 28
HunyuanVideo VAE Encode
  • vae
  • latents_dict
  • hyvid_cfg
  • reference_image
  • vae_concat
height768
width512

If you've ever wondered how image-to-video actually works - how the model knows your first frame should be that exact photo of your dog and not a new one - this node is a big part of the answer. HyVideo15VaeEncode is the piece of the complete HunyuanVideo 1.5 workflow that encodes your reference image into the latent conditioning the transformer consumes. It's one of the split nodes from the comfyui_hunyuanvideo_1.5_plugin pack, and you only meet it when you build the workflow out of components instead of using the one-click sampler.

What it's actually doing

HunyuanVideo 1.5's transformer doesn't see pixels. It sees a latent video: a tensor with a spatial compression of 16x and a temporal compression of 4x from the model's 3D causal VAE. When you run image-to-video, the model needs to be told "this is the first frame, everything after it is yours to invent." That's this node's job. It runs the VAE encoder over your reference image, then lays those latents down on the first frame slot and zeroes out every frame after it, plus a mask that marks the known region. For pure text-to-video it produces the same-shaped all-zero conditioning instead. Either way, out comes a vae_concat tensor that gets concatenated with the noise latents at each denoising step.

This mirrors how the simplified HyVideo15I2VSampler works internally - that node calls this exact logic - so if you're only ever doing stock I2V, you don't need this node at all. It exists for people who want to control the parts, or to experiment with, say, feeding a different kind of condition into the frame slot.

The inputs that matter

  • vae - the loaded HYVID15VAE from HyVideo15VaeLoader.
  • latents_dict - from HyVideo15LatentsPrepare, which also gives you the height and width this node wants.
  • height / width - wire these straight out of HyVideo15LatentsPrepare; they set the resolution the reference image gets resized and center-cropped to.
  • hyvid_cfg - from HyVideo15CFG. This is where the node reads task_type to decide between the i2v and t2v paths.
  • reference_image - optional IMAGE. Leave it out and the node will happily build a zeroed condition, which is correct for T2V and useless for I2V.

The single output, vae_concat, feeds directly into HyVideo15Transformer.

Installing it

It ships in comfyui_hunyuanvideo_1.5_plugin. Easiest is ComfyUI Manager - search for "HunyuanVideo-1.5 nodes". Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/yuanyuan-spec/comfyui_hunyuanvideo_1.5_plugin
cd comfyui_hunyuanvideo_1.5_plugin
pip install -r requirements.txt

Then restart ComfyUI. The requirements pin some heavy things - diffusers==0.35.0, transformers==4.57.1, torch>=2.6.0 - so install them into the same environment ComfyUI runs in, and yes, FlashAttention is worth installing for the 1.5 model in general.

Common issues

Most people hit this node via the complete I2V example workflow, and the usual failure is a shape mismatch: forgetting to wire height/width from HyVideo15LatentsPrepare (the defaults of 768×512 won't match what you generated at), or forgetting to connect the reference_image here even though you fed one into HyVideo15CFG and HyVideo15VisionEncode. The node doesn't complain until the transformer does. If you're getting "conditioned image should have the same number of frames" style errors, that's a mismatch between this node's latents and the ones HyVideo15LatentsPrepare produced - rewire everything from the same sources.

Also note the pack license context: HunyuanVideo 1.5 runs under the Tencent Hunyuan Community License, which is fine for local use but excludes the EU, UK, and South Korea. Worth a glance before you build a product on it.

CategoryHunyuanVideoWrapper1.5

Inputs (6)

NameTypeDefaultDescription
vaeHYVID15VAE
latents_dictHYVID15LATENTSDICT
heightINT768
widthINT512
hyvid_cfgHYVID15CFG
reference_imageoptIMAGE

Outputs (1)

NameTypeDescription
vae_concatHYVID15VAECONCAT