ComfyUI-MiniMax-H3-Inpaint-Tools Introduction
ComfyUI-MiniMax-H3-Inpaint-Tools helps you change part of a finished MiniMax H3 video without generating the whole clip again. You can select an area of the picture, a span of time, or both. The extension also provides tools to replace a soundtrack or generate a continuation of an existing clip.
This is useful when you like a shot’s camera movement, timing, and other details but need to fix one mistake. In the author’s example, a logo contained an extra glyph. Regenerating the entire video could have changed the rest of the shot; the author instead reloaded its saved latent and regenerated only the rectangle around the lettering.
<img src="https://raw.githubusercontent.com/panghea/ComfyUI-MiniMax-H3-Inpaint-Tools/main/docs/media/logo-fix.webp" width="760" alt="A logo before and after a local repair removes an extra glyph from its curved lettering">
The image below highlights every pixel that changed between the two renders. You can also view the full example clips with sound. The footage is sample material and is not covered by this extension’s licences.
<img src="https://raw.githubusercontent.com/panghea/ComfyUI-MiniMax-H3-Inpaint-Tools/main/docs/media/diff-highlight.webp" width="700" alt="Changed pixels in a video render highlighted in red">
How ComfyUI-MiniMax-H3-Inpaint-Tools Works
A latent is the working representation of a clip that the generator uses during creation. Keeping the finished clip’s latent gives the extension something precise to return to when you make a local change.
Think of the extension’s denoise mask as instructions for what to keep and what to redo. A pinned part stays tied to the saved latent throughout sampling; a free part can be generated again. This happens during the generation process, not by pasting a new patch over the finished video. That distinction is why areas left untouched can remain identical to the original render.
MiniMax H3 keeps video and audio in separate parts of its latent. The extension can therefore pin the picture while freeing the audio, or free a selected part of the picture while keeping the rest. For a visual repair, you might select a logo’s rectangle during the frames where it appears. For an audio re-roll, you would keep the entire picture pinned.
To rewrite a region, connect your saved latent through Partial Denoise Mask to SamplerCustomAdvanced.latent_image, and supply real noise with a new seed to SamplerCustomAdvanced.noise:
Finished latent ──► Partial Denoise Mask ──► SamplerCustomAdvanced.latent_image
RandomNoise (new seed) ────────────────────► SamplerCustomAdvanced.noise
A mask works at latent resolution, so it cannot select arbitrarily tiny slices of time or space. In the author’s 107-frame example, the latent had 32 time positions: each position represented roughly 3.3 rendered frames, or about 0.14 seconds at 24 fps. Feathering the edge of a selected region can help make the transition less visible.
ComfyUI-MiniMax-H3-Inpaint-Tools Features
The extension provides ten nodes for selecting what changes, preserving a latent, and preparing related workflows.
| Node | What it helps you do |
|---|---|
| Partial Denoise Mask | Choose which track, time span, or rectangular picture region stays pinned and which part is regenerated. This is the main node for a targeted rewrite. |
| Time Range (frames) | Enter frame numbers and see the corresponding percentages and the frames that will actually be affected. Use it to check your timing before a run. |
| Region Picker | Drag a rectangle over an image to choose the area to change. It can read the frame in the browser when the upstream node is LoadImage or LoadVideo. |
| Save Latent | Store a latent for a later repair, so you can return to the original working representation of the clip. |
| Load Latent | Reload a saved latent. Saved files use safetensors; the default storage format is bf16, and the original data type is restored on load. |
| Pack Latent | Combine separately encoded video and audio latents into the form MiniMax H3 expects. |
| Latent Composite | Blend two finished latents after generation. For a targeted rewrite, the author recommends using the denoise mask instead. |
| Latent Spatial Resize | Change the video latent’s spatial size without resizing its audio. |
| Latent Extend | Extend a latent along time so the original span can stay pinned while a continuation is generated. |
| Latent Inspect | Show latent shapes and data types when you need to check what a workflow is passing between nodes. |
Choosing a starting point: If you already have a saved latent, use it for the repair. The author notes that a Contex Loop chain stores per-clip latents in its checkpoints. For a single-shot R2V, I2V, or T2V workflow, adding Save Latent alongside SaveVideo lets you keep one for later.
If you have only an exported video, you can pass LoadVideo through VAEEncode and VAEEncodeAudio, then use Pack Latent. This makes a repair possible, but encoding the whole clip again introduces a VAE round trip; even areas you do not select may degrade slightly.
The audio-only workflow keeps the picture pinned while generating a new soundtrack against the visible shot. In the author’s measured run at 1664 × 928 pixels and 107 frames on an RTX 3090, a full generation took 845 seconds and an audio re-roll took 360 seconds. These are examples from one setup, not promised runtimes.
The author also tested clip extension from 39 to 73 frames and observed a continuous seam in that run. The author has not repeated it enough times to claim that the result is reliably reproducible.
Troubleshooting ComfyUI-MiniMax-H3-Inpaint-Tools
The selected region comes back as coloured blocks.
- Check that the sampler receives real noise, such as
RandomNoisewith a new seed. - Do not use
DisableNoisefor the masked pass. The author found that it prevents the selected region from being properly regenerated. - If your workflow uses the two-phase PDD warmup, note that its second phase uses
DisableNoiseby design and is not suitable for this masked pass.
A repair changes more of the clip than expected.
- Check the rectangle and time selection using Region Picker and Time Range (frames).
- Use the saved original latent when available.
- If you reconstructed a latent from an exported video, expect some change outside the selection from the additional VAE encode-and-decode process.
The edge of a picture repair is visible. Feather the selected region’s edges. A hard boundary can leave a noticeable seam between the repaired area and the pinned picture.
An encoded video comes back shorter than expected. When encoding an MP4 back into a latent, the author found that its frame length must satisfy length % 17 == 5. Other lengths can silently produce a shorter result. Check the frame count before encoding.
A PDD workflow reports “not a trained PDD block boundary.” A shortened BasicScheduler schedule with denoise < 1 can land outside PDD’s trained boundaries. The author also found that a distilled pass produced worse results than the plain model at the same step count for a text repair. For fine-detail work, start with the plain model and a compatible schedule.
Frequently asked questions
- Can I replace only the audio? Yes. The video and audio are separate parts of the latent, so the picture can stay pinned while the soundtrack is regenerated.
- Will increasing
BasicSchedulersteps while settingdenoise < 1reduce the number of iterations? No. According to the author’s testing,denoise < 1shortens the sigma range, but the scheduler still performs the specified number of steps. - Can I generate small, resize the latent, and finish at full resolution to save time? The author tested this, but it produced a different clip rather than a cheaper version of the same result. In that test, the small-to-large run took 705 seconds versus 845 seconds for direct generation, and legible Japanese text did not form.
- Do more steps always improve a repair? No. In the author’s testing, 25 steps produced a worse result than eight. Check the output rather than assuming a higher step count is better.
- Does changing video resolution also change the audio latent’s length? Not in the author’s comparison: runs of the same shot at 0.4 MP and 1.5 MP had the same audio-latent shape.
Learn More about ComfyUI-MiniMax-H3-Inpaint-Tools
- Browse the six included example workflows and their workflow notes for what each example does, its measured costs, and which connections need to be redirected for your own clip. The author identifies
136_r2v_cut-rewrite-from-mp4.jsonas the closest workflow to the logo-repair example above. The set includes working examples as well as a T2V variant that failed instructively. - Watch the full example clips with sound to compare the demonstrated results beyond still images.
- Read LICENSING.md and COMMERCIAL.md if you need to understand usage terms. The extension and its workflows are GPL-3.0, while its required
minimax-h3-latent-coredependency has separate PolyForm Small Business 1.0.0 terms. The author states that neither licence makes a claim on the work you generate.
