Save 4 hours! We auto-setup your workflow! Free!

Drop your workflow.json — we handle every dependency, custom node, and model. Just open the link and run.

Auto-Setup Workflow Json (Free) Now!
ComfyUI > Nodes > ComfyUI-MiniMaxH3-PerRowMasking

ComfyUI Extension: ComfyUI-MiniMaxH3-PerRowMasking

Repo Name

ComfyUI-MiniMaxH3-PerRowMasking

Author
ethanfel (Account age: 3465 days)
Nodes
View all nodes(2)
Latest Updated
2026-08-07
Github Stars
0.0K

How to Install ComfyUI-MiniMaxH3-PerRowMasking

Install this extension via the ComfyUI Manager by searching for ComfyUI-MiniMaxH3-PerRowMasking
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-MiniMaxH3-PerRowMasking in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-MiniMaxH3-PerRowMasking Description

ComfyUI-MiniMaxH3-PerRowMasking regenerates selected areas of MiniMax H3 video using grid-aligned masks and per-row sampling, while preserving unmasked footage and, optionally, the original audio.

ComfyUI-MiniMaxH3-PerRowMasking Introduction

ComfyUI-MiniMaxH3-PerRowMasking helps you regenerate selected parts of a MiniMax H3 video while keeping the rest of the source video and, if you choose, its audio. For example, you can mask a moving object so H3 redraws that area while the unmasked parts remain tied to the original footage.

This extension is a temporary, experimental compatibility tool. It brings the author’s adaptation of AbleJones’s per-row masking fix into a ComfyUI workflow without changing ComfyUI’s core files. It is intended for use while native MiniMax H3 generation-mask support is pending. Once ComfyUI supports this behavior directly, remove the custom node and use the core implementation.

The extension also helps prepare source footage for H3: it trims frames to a valid length, lets you inspect how your mask aligns with H3’s working grid, and attaches the mask to the combined video-and-audio latent used for sampling.

How ComfyUI-MiniMaxH3-PerRowMasking Works

Think of a mask as instructions painted over your video: white marks what H3 should generate; black marks what it should preserve. You can reverse that meaning with the mask-meaning setting.

H3 does not make these decisions one source pixel at a time. Its video representation is divided into larger working cells. With the current VAE, each selected cell corresponds to roughly 32 × 32 pixels of the source image. The grid preview shows which complete cells your mask will select, so you can check the effective area before sampling. A very small mark may disappear when the mask is reduced to H3’s working resolution.

The per-row patch then gives the selected and protected parts of the combined video-and-audio latent different treatment during sampling. Rows being generated follow the normal denoising schedule; protected rows stay near H3’s conditioning timestep. In practical terms, this allows H3 to work on masked areas without treating every row as though it needs to be regenerated.

The patch applies only to the MODEL output by its node. Other connections to the original model are not changed.

ComfyUI-MiniMaxH3-PerRowMasking Features

Trim Source AV to a Valid H3 Length

MiniMax H3 Trim Source AV to 17k+5 takes a batch of source video frames and optional synchronized audio. It removes trailing frames until the frame count is the largest valid H3 17k+5 length that does not exceed your source. It does not add frames, resize the image, or change the frame rate.

The node returns trimmed frames, trimmed audio when supplied, an exact h3_length value for the H3 conditioning node, and a readable report. Audio is trimmed to the returned video duration using H3’s fixed 24 fps timing. If the audio ends earlier than the video, the node reports the mismatch and leaves the audio short; it does not add silence.

Use this node before splitting frames into masking, preview, and video-encoding branches. That keeps all branches working with the same span of footage.

Preview and Snap the Mask to H3’s Grid

MiniMax H3 Mask Grid Preview & Snap shows the cells that will be selected and outputs a cell-snapped mask for the generation-mask node. It accepts a standard ComfyUI mask, including one from SAM3 Detect, SAM3 Track to Mask, or a mask editor.

The preview uses orange for selected cells and cyan for grid lines. It can also show a white outline of your original mask, making it easier to compare what you painted or tracked with what H3 will use. A grid summary provides a text description of the selection.

You can adjust how cells are chosen:

  • Runtime exact (latent max) is the default. It reproduces the spatial mask reduction and per-row selection used during H3 sampling. Use it to inspect the selection the runtime would make.
  • Pixel-coverage modes offer broader or more conservative ways to choose cells. Use any pixel coverage when even a tiny marked source pixel must select its entire cell.
  • Whole-cell grow/shrink expands or contracts the selected area by complete cells. Growing can provide more room around an object; shrinking can limit changes near its edge.
  • Preview overlay controls change how you inspect the selection without changing the underlying source footage.

Feed the preview an image or frame batch at the exact canvas size you will encode for H3. Both dimensions must be divisible by 32. If they are not, the node stops with an alignment error rather than showing a misleading preview.

Set the Video and Audio Generation Mask

MiniMax H3 Set Generation Mask takes the combined source video-and-audio LATENT and a video-space MASK. It returns the joint AV latent with the H3 noise mask attached.

You can set whether white generates or white preserves, depending on how your mask was made. You can also choose to generate audio or preserve the complete source audio. A single mask frame applies across the video; a batch of masks can follow an object as it moves over time.

Patch the Model for Per-Row Sampling

MiniMax H3 Per-Row Mask Patch (Experimental) accepts a MiniMax H3 MODEL and returns a patched MODEL. Connect that output to the guider used by your sampler. The node clones the input model, so unrelated connections using the original model are left alone.

The patch supports the earlier H3 audio-slope contract and the newer ModelSamplingAV contract described in the original documentation. It also preserves the block_loop hook used by lihaoyun6/ComfyUI-MiniMaxH3-Cache and per-block replacement hooks, including attention patches. Because it relies on H3 internals rather than a stable public interface, test a short generation after each ComfyUI update.

ComfyUI-MiniMaxH3-PerRowMasking Workflow

  1. Send your source frames and optional synchronized audio through MiniMax H3 Trim Source AV to 17k+5.
  2. Resize or crop the trimmed frames to your exact H3 canvas. Split that same frame batch toward mask creation, grid preview, and video encoding.
  3. Encode the source video with the correct MiniMax H3 video VAE. Encode or create the source audio latent, then join the two with ComfyUI’s Concat AV Latent node.
  4. Connect your mask and the resized source frames to MiniMax H3 Mask Grid Preview & Snap. Check the preview to see which cells are selected.
  5. Connect the snapped mask and the joint AV latent to MiniMax H3 Set Generation Mask. Choose your mask meaning and audio mode.
  6. Pass the MiniMax H3 model through MiniMax H3 Per-Row Mask Patch (Experimental) and connect its patched output to the guider.
  7. Sample the masked joint latent normally.

The source video belongs in the main latent. You do not need to pass the same footage again as an H3 <Video> reference just to enable masking.

For a complete graph, open the MiniMax H3 Per-Row Video Inpaint example workflow in ComfyUI. It demonstrates source AV extraction, automatic trimming, canvas resizing, grid checking, source encoding, masked sampling, and synchronized video/audio decoding. The example expects a 24 fps video with an audio track; select your own source video and mask after loading it. Its Load Image (as Mask) node reads white from the chosen image’s red channel and applies that static mask across time. For a moving mask, replace its mask connection with a SAM3 Track to Mask output.

Troubleshooting ComfyUI-MiniMaxH3-PerRowMasking

The grid preview reports an alignment error.
Check that the image connected to the preview has the same dimensions as the frames you will encode for H3. Resize or crop it so both width and height are divisible by 32, then run the preview again.

A small masked detail does not appear in the selected cells.
First inspect the preview overlay. In the default runtime-exact mode, a tiny isolated mark can disappear while the mask is reduced to H3’s latent resolution. Switch to any pixel coverage if every marked source pixel must select its cell. You can also grow the selection by whole cells when the edit needs more surrounding space.

The mask and video seem to cover different moments or areas.
Check that trimming happens before you split the frames into separate branches. Use the same trimmed and resized frame batch for mask creation or preview and for H3 video encoding. If the subject moves, use a mask batch that follows it rather than a single static mask.

The audio is shorter than the returned video.
Read the trim report. The trim node does not create silence to fill missing source audio. Use source material with audio covering the intended video duration, or account for the shorter audio elsewhere in your workflow.

The patch rejects the model.
Confirm that the model connected to MiniMax H3 Per-Row Mask Patch (Experimental) is a MiniMax H3 model. The node deliberately reports an error for another model or when required H3 internals are unavailable. Because this is a temporary compatibility shim, try a short test after changing your ComfyUI build.

Frequently Asked Questions

Will the trim node change my frame rate or image size?
No. It only drops trailing video frames to reach a valid length. Audio trimming uses H3’s fixed 24 fps timing.

Can I keep the original audio?
Yes. The generation-mask node offers an option to preserve the complete source audio.

Can I edit an object that moves across the video?
Yes. A batch of masks can change from frame to frame. The example workflow shows where you can connect SAM3 Track to Mask instead of its static mask.

Does white always mean “regenerate”?
That is the default, but the generation-mask node also supports white preserves.

Does this extension permanently modify ComfyUI?
No. The patch is scoped to the model returned by its node and does not require editing ComfyUI core files.

Learn More about ComfyUI-MiniMaxH3-PerRowMasking

The author credits AbleJones/drozbay for the original per-row algorithm and implementation, and Kijai and the ComfyUI MiniMax H3 contributors for the H3 integration targeted by this temporary shim. The extension is licensed GPL-3.0-or-later; portions are adapted from ComfyUI and the cited experimental patch.

ComfyUI-MiniMaxH3-PerRowMasking Related Nodes

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

ComfyUI-MiniMaxH3-PerRowMasking detailed guide | ComfyUI