Nodes/MiniMax H3 Inpaint Tools/MiniMax H3 Latent Composite
ComfyUI Node

MiniMax H3 Latent Composite

Swapping audio or patching a region across two finished H3 clips

By panghea·Created 4 days ago·Updated 3 days ago· 6
MiniMax H3 Latent Composite
  • base
  • overlay
  • samples
audiokeep base
audio_mix0.50
videokeep base
x_pct0.0
y_pct0.0
w_pct100.0
h_pct100.0
feather_pct6.0
t_start_pct0.0
t_end_pct100.0
t_feather_pct4.0

Sometimes the clean solution isn't available, and that's when MiniMaxH3LatentComposite earns its place. Its sibling, Partial Denoise Mask, is the pack's preferred way to rewrite part of a clip - but a denoise mask only works when you're re-sampling a latent you're still holding. If you've already generated two finished clips and want to stitch parts of them together, the mask is no help. This node blends latents after the fact: take the audio from one run, or a rectangle-and-time-span of the picture from another, and hand the result to a decoder.

How it works

H3's latent is a NestedTensor holding two independent tensors:

  • video: (B, 24, T, H, W) - an ordinary grid, so a rectangle of it can be replaced and feathered.
  • audio: (B, 32, 2, L) - a separate tensor whose length doesn't scale with resolution.

Because they're separate, the audio from a different run entirely slots straight in with nothing to resize - a cheap 0.4 MP pass produces an audio latent with the identical shape to the one from a finished 1.5 MP clip. Two things this buys you:

  • Audio re-roll. Sample a cheap small pass with a new seed, keep only its audio, put it on the finished big clip's video. The picture is untouched and the audio is a fresh take.
  • Partial rewrite. Sample the same shot twice - different seeds or an edited prompt - then keep clip B only inside a rectangle and/or time span. Everything the two runs share stays bit-identical, so the seam has little to hide.

Honest framing, though: this is a post-sampling composite. Both clips were fully generated, so it's more expensive than masking would have been, and the mask is the pack's preferred route whenever you can still re-sample. The source even explains why the mask can't always do the audio job - the mask gets broadcast onto the audio tensor too and the shapes don't match. Composite exists for the cases the mask can't reach.

The inputs that matter

  • base - the clip you're keeping ("The clip you are keeping", per the tooltip).
  • overlay - the clip you're taking from.
  • audio - keep base, take overlay, or mix. For mix, audio_mix is the crossfade: 0 = base, 1 = overlay.
  • video - keep base, take overlay, or region. In region mode the x_pct/y_pct/w_pct/h_pct rectangle (feathered by feather_pct) and the t_start_pctt_end_pct span (feathered by t_feather_pct) are lifted from the overlay and dropped into the base.

The rectangle and time-span percentage inputs work exactly like the Partial Denoise Mask's - you can feed them from the Region Picker and Time Range nodes.

Errors you'll meet

Both inputs must carry a video latent, and if you choose take overlay the two video tensors have to match shape exactly - it raises video latents differ in shape otherwise. If your two runs don't match resolution, resize one to the other first with the pack's Latent Spatial Resize, which knows to leave the audio alone.

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 sits under MiniMax H3/latent, fed by a Load Latent on each side.

CategoryMiniMax H3/latent

Inputs (13)

NameTypeDefaultDescription
baseLATENTThe clip you are keeping.
overlayLATENTThe clip you are taking from.
audioCOMBOkeep base3 options: keep base, take overlay, mix
audio_mixFLOAT0.500–10 = base, 1 = overlay. Only used for "mix".
videoCOMBOkeep base3 options: keep base, take overlay, region
x_pctFLOAT0.00–100Left edge of the rewritten rectangle, %.
y_pctFLOAT0.00–100
w_pctFLOAT100.00–100
h_pctFLOAT100.00–100
feather_pctFLOAT6.00–50Soft edge on the rectangle, % of frame.
t_start_pctFLOAT0.00–100Start of the rewritten span, % of the clip.
t_end_pctFLOAT100.00–100
t_feather_pctFLOAT4.00–50

Outputs (1)

NameTypeDescription
samplesLATENT