Nodes/MiniMax H3 Inpaint Tools/MiniMax H3 Pack Latent (video + audio)
ComfyUI Node

MiniMax H3 Pack Latent (video + audio)

Rebuild a MiniMax H3 latent from video and audio when you forgot to save it

By panghea·Created 4 days ago·Updated 3 days ago· 6
MiniMax H3 Pack Latent (video + audio)
  • video_latent
  • audio_latent
  • samples

You didn't save the latent. Maybe you didn't know the pack existed yet, maybe you were working from someone else's mp4, maybe you just assumed the graph kept it. Either way you're holding a finished H3 clip and you want to rewrite part of it - and Partial Denoise Mask won't touch a video file. MiniMaxH3PackLatent is the salvage path: encode the clip's picture and its sound separately, pack the two latents into the nested form H3 expects, and suddenly you have a latent you can mask and re-roll.

How it works

H3 stores [video, audio] in one NestedTensor. ComfyUI's VAEEncode handles one and VAEEncodeAudio the other - but H3 uses two separate VAEs, a video VAE and an audio VAE, and you have to feed each encoder its own. This node takes the results and does the packing:

  • video_latent - from VAEEncode using the H3 video VAE. It should be (B, C, T, H, W), and if you feed it a nested latent by mistake it helpfully pulls out the 5-D tensor for you.
  • audio_latent - from VAEEncodeAudio using the H3 audio VAE. Same unwrapping in reverse.

One output, samples, the packed nested latent ready for the mask node, the save node, or whatever else needs a proper H3 latent. If the video side isn't 5-D it raises a clear error naming the shape it found.

The cost, honestly

The README does not sugar-coat this: rebuilding a latent this way costs one VAE round trip across the whole clip, and a VAE round trip is lossy. Untouched regions degrade slightly too, because the latent you get is the encode of the decoded video, not the latent the sampler produced. For editing that's usually fine - you're about to re-roll a region anyway. For archiving it isn't; that's what Save Latent is for, at zero loss and ~430 MB a clip.

The other gotcha the author hit and documented: encoding an mp4 back into a latent needs length % 17 == 5, and an invalid length silently comes back shorter. If your packed latent's time axis looks wrong, check the source clip's frame count against H3's grid before blaming the pack.

Why this is the right shape anyway

This is also the escape hatch for clips that never had a latent to save. The workflow the README walks through: LoadVideo into VAEEncode + VAEEncodeAudio, then Pack Latent, then mask. And because the pack's Load Latent, Save Latent, Time Range and the rest all speak the same nested-LATENT type, everything downstream just works once the pack is done.

Install

ComfyUI Manager, search MiniMax H3 Inpaint Tools, or:

cd ComfyUI/custom_nodes
git clone https://github.com/panghea/ComfyUI-MiniMax-H3-Inpaint-Tools
cd ComfyUI-MiniMax-H3-Inpaint-Tools && pip install -r requirements.txt

Restart and it's under MiniMax H3/latent. No extra models to download beyond what an H3 setup already has - the pack itself ships nothing.

CategoryMiniMax H3/latent

Inputs (2)

NameTypeDefaultDescription
video_latentLATENTFrom VAEEncode with the H3 VIDEO vae.
audio_latentLATENTFrom VAEEncodeAudio with the H3 AUDIO vae.

Outputs (1)

NameTypeDescription
samplesLATENT