Nodes/ComfyUI-MiniMaxH3-Contex-Loop/MiniMax H3 Masking · Master Audio + Video Prefix
ComfyUI Node

MiniMax H3 Masking · Master Audio + Video Prefix

Lock a real soundtrack into H3 without letting denoising mangle it

By ethanfel·Created 17 days ago·Updated about 20 hours ago· 315
MiniMax H3 Masking · Master Audio + Video Prefix
  • latent
  • audio_vae
  • master_audio
  • vae
  • source_frames
  • source_latent
  • latent
  • trim_frames
  • clip_audio
clip_start_seconds0.000
context_length39
source_fps24.000
cropdisabled

MiniMax H3 generates audio jointly with the picture, which is great until you already have the music or dialogue and need it to survive the render note-for-note. This node is how you get that: it drops an exact slice of your master audio into H3's complete audio target, then masks that interval so denoising can't touch it. If you've watched H3 "interpret" a song and drift into a slightly different take, this is the node that stops the improvisation.

What it does

The full master_audio timeline (music, dialogue, narration, effects - anything you already have) is connected once. The node reads clip_start_seconds to find the current raw H3 clip's interval, VAE-encodes that exact slice into the target latent via the audio_vae, and protects it with an all-zero audio denoise mask. The target's audio is authoritative - the reference bank and any carried predecessor can't compete with it. That's the same "lock source audio" behavior the Chain Policy switch enables, but as a discrete node that works on your prerecorded master rather than the source timeline.

The video side is optional: context_length (native runs like 5, 22, 39, 56…) requests a protected previous-video prefix. Two ways in:

  • source_latent - the preferred live path. It copies the phase-aligned tail of the previous sampled H3 video latent directly. Its audio is ignored, because master_audio is authoritative.
  • source_frames - the legacy decoded path. Requires the video vae, plus source_fps and crop (disabled stretches, center preserves aspect and crops). Use this only when you don't have a latent to hand off.

The three outputs you actually care about

  • latent - the sampler target, with exact protected audio and the optional video prefix baked in.
  • trim_frames - how many decoded frames the protected visual prefix occupied. Feed it to Loop Trim so the repeated head comes off picture and sound together.
  • clip_audio - the exact master-audio interval this raw clip represents, handy for review or a downstream mix.

Install and gotchas

cd ComfyUI/custom_nodes
git clone https://github.com/ethanfel/ComfyUI-MiniMaxH3-Contex-Loop.git

Restart, or grab it from ComfyUI Manager under "MiniMax H3 Contex Loop". No pip step; you do need a current ComfyUI (native Add Guide for MiniMax H3 from PR #15439) and ideally ffmpeg on PATH. Models and VAEs aren't bundled - you bring the H3 weights plus video and audio VAEs, and remember the MiniMax H3 Community License restricts local weights outside the US/EU/UK/Korea block.

The common mistake is feeding the whole movie into Ref2VA and treating it as the audio master. Keep one job per wire: this node owns the exact target clock, and your source video shouldn't double as a loose reference. And don't zero out context_length expecting to keep the previous clip's audio - with master audio connected, the master is the boss; context_length only controls the visual prefix.

Categoryconditioning/minimax/contex_loop/masking

Inputs (10)

NameTypeDefaultDescription
latentLATENTTarget AV latent from the stock MiniMax H3 conditioning node.
audio_vaeVAEMiniMax H3 audio VAE used to encode the exact master-audio slice into the target latent.
master_audioAUDIOFull prerecorded audio timeline (music, dialogue, narration, or effects). The exact current interval is inserted into the target and fully protected.
clip_start_secondsFLOAT0.0000–99999Start of this raw H3 clip on the master-audio timeline.
context_lengthINT390–9999Previous-video prefix request. Native runs such as 5, 22, 39, 56... are used; 0 disables video prefixing when neither source input is connected.
source_fpsFLOAT24.0001–240Frame rate of the legacy decoded source_frames path. It is ignored when source_latent is used.
cropCOMBOdisabledResize policy for legacy source_frames: disabled stretches to the target canvas; center preserves aspect ratio and center-crops. Ignored when source_latent is used.
vaeoptVAEMiniMax H3 video VAE; required when previous source_frames are connected.
source_framesoptIMAGELegacy decoded continuation path. Its final native H3 context run is VAE-encoded into the protected video prefix. Prefer source_latent for live H3 chaining.
source_latentoptLATENTPreferred live continuation path. The phase-aligned tail of the previous sampled H3 video latent is copied directly; its audio is ignored because master_audio remains authoritative.

Outputs (3)

NameTypeDescription
latentLATENTSampler target with exact protected master audio and optional protected previous-video prefix.
trim_framesINTActual protected visual prefix length; trim this many decoded frames.
clip_audioAUDIOExact master-audio interval represented by this raw target.