Nodes/ComfyUi-MpiNodes/Mpi H3 Encode AV
ComfyUI Node

Mpi H3 Encode AV

One latent that carries picture and sound together

By MadPonyInteractive·Created 11 months ago·Updated a day ago· 3
Mpi H3 Encode AV
  • vae
  • images
  • audio_vae
  • audio
  • latent

MiniMax H3's party trick is that audio and picture are born together - one omni-modal model producing synced stereo sound and video in a single pass, and the first serious open-weights answer to the native-audio gap that Veo used to own alone. So it's a genuine surprise that core ComfyUI won't let you treat the two streams as one thing.

Core encodes video with VAEEncode and audio with VAEEncodeAudio, and there's no built-in way to join the results into the single joint AV latent that the interesting H3 workflows want. The only third-party route used to be a fork that monkey-patches two ComfyUI internals at import time - fragile, and a pinning headache every time ComfyUI updates. MpiH3EncodeAV is the clean version of that hack: give it a clip and its soundtrack and it hands you one LATENT with both halves packed inside.

That single output is exactly what MpiH3MaskedPrefix takes as its context, and it's what any "carry this clip forward" workflow is built on. Skip this node and you're holding a video latent and an audio latent that nothing will zip together for you.

What goes in

Four inputs, all required, and all things you already have once H3 is running:

  • vae - the H3 video VAE.
  • images - the clip's frames at 24 fps, as ONE batch. This is the field that burns people: encoding them in separate calls throws away the motion the temporal packing carries, because the VAE packs frames per latent step on a period-5 cycle (1, 4, 4, 4, 4). Feed the whole clip in one IMAGE tensor, or the seam you get later won't be where you think it is.
  • audio_vae - the H3 audio VAE.
  • audio - the soundtrack. If its sample rate doesn't match the audio VAE's own (32 kHz), the node resamples it with torchaudio before encoding, so you don't need to match rates by hand.

The one output, latent, is the packed AV pair as a ComfyUI NestedTensor - the same structure the H3 nodes themselves emit, ready for the sampler or for MpiH3MaskedPrefix.

How it works

Honest and boring, in the best way: vae.encode() on the frames, audio_vae.encode() on the (resampled) waveform, then both go into comfy.nested_tensor.NestedTensor((video_z, audio_z)). One deliberate constraint: batch size 1 only. H3 itself is batch 1, and a second item wouldn't error - it would silently pair the wrong soundtrack with the wrong picture - so the node refuses instead of guessing.

Installing it

This is one node in Mad Pony Interactive's ComfyUi-MpiNodes pack - over a hundred utilities from the team behind the Cubric Vision app, AGPL-3.0 since 1.2.7 - and it installs the same way regardless of which Mpi node you're after. ComfyUI Manager: search "ComfyUi-MpiNodes" and hit install. Or do it by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes

Restart ComfyUI and you're done - the pack ships no requirements.txt, so there's no pip step. torchaudio is imported lazily only when this node actually runs, and ComfyUI's own audio nodes already depend on it, so on a normal H3-capable install you never think about it.

None of the Mpi H3 nodes download models. You need the H3 weights (~42.5 GB, from MiniMaxAI/MiniMax-H3) plus the H3 video VAE and audio VAE sitting on the usual ComfyUI model paths. Worth a pause before you pull them: the H3 Community License excludes the US, EU, UK and South Korea from its Applicable Territory - running the local weights there isn't licensed, and the hosted Hailuo API is the legal route in those regions.

Common issues

  • Frames split across multiple batches - motion is lost and the later seam lands early. One encode call for the whole clip, period.
  • "latent carries video only" - that's MpiH3MaskedPrefix refusing a context latent with no audio half, which is what you get if you hand it a plain VAEEncode output or leave audio_vae/audio unwired. The context has to come out of this node, complete.
  • ModuleNotFoundError: torchaudio - appears only at runtime because the import is lazy. On a normal H3-capable ComfyUI this never happens (core audio nodes already need torchaudio); if it does, install it into your ComfyUI Python environment.
  • Nothing here downloads H3. This node is glue; the weights and the two VAEs are on you.
CategoryMpiNodes/Utils

Inputs (4)

NameTypeDefaultDescription
vaeVAEThe H3 video VAE.
imagesIMAGEThe clip's frames at 24 fps, as ONE batch - encoding them in separate calls throws away the motion the temporal packing carries.
audio_vaeVAEThe H3 audio VAE.
audioAUDIOThe clip's soundtrack. Resampled to the audio VAE's own rate if it does not already match.

Outputs (1)

NameTypeDescription
latentLATENT