MiniMax H3 • Encode Audio Stream
Get your soundtrack into H3's latent space, properly
- audio_vae
- audio
- target_av
- audio_latent
- duration_seconds
- sample_rate
MiniMax H3 is an omni-modal model: it treats video and audio as one joint latent, not as a picture with a soundtrack bolted on. That's the whole trick of its native lip-sync and generated audio. But it means plain ComfyUI audio can't just be plugged into the sampler - it has to be encoded by the H3 audio VAE into a 32-channel stereo audio stream first. That's exactly what this node does, and it's the piece people quietly forget when their "reference audio" does nothing.
What it does
Feed it an audio (ComfyUI's AUDIO type), an audio_vae (the H3 audio VAE, a separate file from the video VAE), and a fit_mode, and it returns an audio_latent ready for Pack AV or Replace Stream.
Three fit modes, in order of how much it will argue with you:
strict- the input must already match what the target wants, or it errors.crop_or_pad_silence- silently crops or pads to length. The one you'll actually use.loop- repeats the audio to fill the target.
The useful extra input is target_av, an optional H3 AV latent. Connect it and the node resamples and fits the encoded stream so its duration exactly matches the target latent's audio shape. That's the fix for the classic mismatch where your 9.8-second voice clip refuses to align with a 10-second video clip. Without a target, duration comes from whatever the audio VAE produces.
Under the hood it resamples to the audio VAE's sample rate (32 kHz by default) using torchaudio, encodes with the audio VAE, and derives duration from the latent length at the pack's internal audio-frames-per-second rate.
Outputs
audio_latent(LATENT) - the encoded stream. Wire into Pack AV Streams or Replace Stream.duration_seconds(FLOAT) - how long the encoded audio actually is. Handy to display or feed a calculator.sample_rate(INT) - the rate it ended up at, which after resampling is the VAE's rate.
Why you reach for it
Two main jobs. First, reference conditioning: H3 understands <Audio N> references for rhythm, dialogue and lip-sync timing, and you get audio into that system by encoding it here. Second, editing: encode an external soundtrack, then use Replace Stream (stream=audio) to swap the model's generated audio for your own while keeping the video latent. There's also a shortcut: the Long Media Setup node takes AUDIO references directly on its audio_1..audio_3 inputs, so in the standard workflow you may never touch this node at all. You reach for the standalone encode when you're assembling streams by hand.
Install
Comes with the ComfyUI-MiniMax-H3-LongMedia pack - Manager search "MiniMax-H3-LongMedia", or:
cd ComfyUI/custom_nodes
git clone https://github.com/vizart-vj/ComfyUI-MiniMax-H3-LongMedia
restart, and grab the H3 checkpoint, video VAE and audio VAE from MiniMaxAI/MiniMax-H3 on HuggingFace (remember the H3 Community License excludes the US, EU, UK and Korea - verify you're allowed before downloading ~42.5 GB of weights).
Troubleshooting
If strict errors on length, that's the H3 frame grid talking - durations snap to the 17×k+5 frame lattice at 24 fps, so a "5 second" clip is rarely exactly 5.0 seconds. Use crop_or_pad_silence with target_av connected and stop fighting it. And if the encoded audio seems to have no effect on sampling, check that you're actually feeding the resulting latent into the sampler's AV path rather than expecting the raw AUDIO to flow through - H3 only sees what gets encoded.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| audio_vae | VAE | — | |
| audio | AUDIO | — | |
| fit_mode | COMBO | 3 options: strict, crop_or_pad_silence, loop | |
| target_avopt | LATENT | Optional H3 AV latent whose audio shape is the target. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| audio_latent | LATENT | — |
| duration_seconds | FLOAT | — |
| sample_rate | INT | — |