Nodes/ComfyUI-MiniMaxH3-PerRowMasking/MiniMax H3 Set Generation Mask
ComfyUI Node

MiniMax H3 Set Generation Mask

Where MiniMax H3 actually learns what to regenerate (and what white means)

By ethanfel·Created 2 months ago·Updated 2 months ago· 1
MiniMax H3 Set Generation Mask
  • av_latent
  • mask
  • masked_av_latent
mask_meaning
audio_mode

MiniMax H3 is a 33B omni-modal model that treats video and its synchronized audio as one joint latent - which is great for lip-synced results and a headache for inpainting, because a normal image-style mask doesn't know what to do with audio at all. MiniMaxH3SetGenerationMask is the node that attaches the actual generation mask to that joint latent, and it's the only one in the workflow where you decide the semantics: which pixels are rewritten, and whether the soundtrack is fair game.

What you feed it

Three inputs matter, and they map cleanly onto three decisions:

  • av_latent - the joint video+audio latent. You don't get this by magic: VAE-encode your source video with the MiniMax H3 video VAE, encode or create the audio latent, then combine them with ComfyUI's Concat AV Latent node before connecting. Feed anything else here and the node stops with a clear error telling you it needs the joint latent.
  • mask - a video-space mask, white = requested generation area by default. It can be a single frame (applied across the whole clip) or a batch that follows motion across the source video. The sampler resizes and snaps it to H3's patch grid, so don't worry about drawing at pixel-perfect resolution.
  • mask_meaning - white = generate or white = preserve. The white-generates convention is ComfyUI's usual one, but being able to flip it is handy when your SAM3 track is easier to think of as "keep this thing."
  • audio_mode - generate audio or preserve source audio. This is the H3-specific choice nobody else has. Preserve pins the complete source-audio latent while you edit only the picture; generate lets the model re-synthesize sound along with the new pixels.

How it works

Under the hood it's unglamorous but precise: it reads the nested joint latent, converts your mask, inverts it if you chose white = preserve, builds a matching audio mask (all-generate or all-preserve), and tucks the pair away as a nested noise_mask on the latent copy. The sampler reads that mask and - this is the part where its sibling node MiniMaxH3PerRowMaskPatch earns its keep - snaps it onto H3's per-row grid and runs the mixed-timestep pass, pinning protected rows near H3's conditioning timestep while generated rows denoise normally.

That division of labor trips people up at first. Set Generation Mask only labels the latent. The patch node changes the sampler's behavior. Wire one without the other and you've built a mask nobody reads.

Outputs

One output: masked_av_latent, which feeds straight into your sampler. The whole point is that the source video lives inside that latent - the README is blunt that you should not also pass it in as an H3 <Video> reference just to make masking work, or the two will fight.

Where it sits

In the pack's example workflow the order is: trim source → resize to the H3 canvas → VAE-encode video → Concat AV Latent → this node (with a snapped mask from MiniMaxH3MaskGridPreview) → sampler guided by the patched model. If your masked result looks like it ignored the mask entirely, work backwards: check that the latent is truly joint, that the mask actually reached this node, and that the patched model is on the guider.

Install from ComfyUI Manager (search ComfyUI-MiniMaxH3-PerRowMasking) or:

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

Restart and you're done - the pack pulls in no extra Python packages.

Categorylatent/mask/minimax

Inputs (4)

NameTypeDefaultDescription
av_latentLATENTJoint source video+audio latent. Encode the source media, then combine it with Concat AV Latent before connecting it here.
maskMASKVideo-space generation mask. It may contain one mask frame or a batch matching the source video. The sampler resizes and snaps it to H3's patch grid.
mask_meaningCOMBOChoose whether white pixels are edited or protected.
audio_modeCOMBOGenerate audio normally, or pin the complete source-audio latent while editing video.

Outputs (1)

NameTypeDescription
masked_av_latentLATENT