Nodes/ComfyUI-EmptyHunyuanLatent/EmptyHunyuanLatentForVideo
ComfyUI Node

EmptyHunyuanLatentForVideo

Hunyuan Video won't take an EmptyLatentImage — this node makes the latent it actually wants

By ShmuelRonen·Created 2 years ago·Updated 2 years ago· 10
EmptyHunyuanLatentForVideo
    • LATENT
    resolution
    length25
    batch_size1

    If you've ever wired Hunyuan Video's sampler to a plain EmptyLatentImage and watched the whole thing refuse to run, you already know why this node exists. Text-to-video models don't denoise in the same latent space as Stable Diffusion. Hunyuan Video's 3D causal VAE works in a 5D latent with 16 channels and a time axis, while the classic EmptyLatentImage hands you a 3D, 4-channel tensor [B, 4, H/8, W/8]. Those are different shapes for different models, and the sampler isn't going to fake it for you. This node makes a zero-filled latent that Hunyuan Video actually accepts, with a dropdown so you never have to think about aspect ratios.

    This is a niche tool for a niche audience, so let's be honest about the context: Hunyuan Video was the open-source video pioneer in December 2024, but it wanted 45–60GB of VRAM at launch, and the ecosystem moved to Wan and LTX while it sat there. Version 1.5 (late 2025) cut it to 8.3B params and a ~14GB floor with offloading, which is why people still run it. If you're reaching for it, you're probably here for its I2V consistency, its uncensored behavior out of the box, or that "cinematic" look some people love and others call washed out. Either way, you need an empty latent shaped like the model, and that's this node's entire job.

    How it works

    The mechanism is refreshingly small. Pick a resolution from the 42-entry dropdown, set a length, and the node runs torch.zeros on ComfyUI's current compute device:

    • length frames become T = ((length - 1) // 4) + 1 latent frames
    • Output shape: [batch_size, 16, T, height // 8, width // 8]

    The // 4 is the VAE's 4x temporal compression - the same "you get your clip back a couple frames short" math that trips people up with Wan. Every resolution preset is already a multiple of 16, and the code floors both dimensions defensively, so you can't produce an off-grid latent. It's a tiny, dependency-free utility: the whole pack is one Python file with no pip requirements beyond ComfyUI and torch. The heavy lifting is entirely in the Hunyuan model you plug it into.

    The inputs that matter

    Three widgets, and you'll mostly touch two of them:

    • resolution - dropdown of 42 common formats, from 256x256 (1:1) up to 1728x576 (3:1), covering portrait, square, and landscape. Pick a preset and move on; for 720p output you want the 1024x576 (16:9) / 1344x704 (16:9) end of the list.
    • length - number of frames, default 25, max 16384, stepped by 4. The README still calls this "frames," but the actual widget is length, so don't go hunting for a frames field. More frames costs VRAM and time roughly linearly, and Hunyuan is already slow.
    • batch_size - default 1, up to 4096. Almost always leave it at 1; this is video, not a thumbnail contact sheet.

    The single output is a LATENT that wires straight into your sampler's latent input, then VAE decode → VHS_VideoCombine → mp4. In an image-to-video workflow you can skip this node entirely and feed the VAE-encoded image latent directly - this one is for starting from nothing.

    Installing it

    Easiest path is ComfyUI Manager: search "EmptyHunyuanLatent" and hit install. Or, the manual way:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ShmuelRonen/ComfyUI-EmptyHunyuanLatent
    

    Then restart ComfyUI and the node appears under latent/video.

    Heads-up: the README's own clone command is stale - it says ComfyUI-Hunyuan-Latent.git, which is the pack's old name and will 404. Use the URL above. The node itself downloads nothing; what you do still need is the Hunyuan Video checkpoint (the author points at Comfy-Org/HunyuanVideo_repackaged for the text encoders and recommends the hunyuan_video_720_cfgdistill_fp8_e4m3fn model - the FP8 quantized, cfg-distilled build - for fast operation on consumer cards).

    Where people get burned

    First: don't "fix" the channel count. The README claims the video output is [B, 4, frames, H/8, W/8], but the shipped code writes 16 channels. Trust the code. Hunyuan's VAE legitimately uses 16 latent channels, so if you see 16 and think it's a bug, it isn't.

    Second, know that current ComfyUI core already ships its own EmptyHunyuanLatentVideo for Hunyuan workflows - this node is a friendlier reimplementation with the preset dropdown. You don't need both. The niche this fills is the convenience of picking "576x1024 (9:16)" instead of typing width/height/length and hoping you hit a divisible-by-4 number.

    Third, mind your VRAM budget. An empty latent is free; the 13B model that denoises it is not. If you're on 8–12GB, keep resolutions moderate and remember the FP8 build exists precisely so you don't have to.

    Categorylatent/video

    Inputs (3)

    NameTypeDefaultDescription
    resolutionCOMBO42 options: 256x256 (1:1), 256x384 (2:3), 384x256 (3:2), 320x448 (5:7), 448x320 (7:5), 384x512 (3:4), +36
    lengthINT251–16384
    batch_sizeINT11–4096

    Outputs (1)

    NameTypeDescription
    LATENTLATENT