MiniMax H3 Masking · Loop Mask Slice
Slice your tracked mask to exactly the scene H3 is about to render
- state
- mask
- scene_mask
- scene_mask_frames
- status
Loop Mask Slice is the plumbing that keeps spatial masks aligned with a moving MiniMax H3 chain. You have a mask - a static one drawn once, or a full tracked mask timeline from a tracker - and you have a chain loop that renders one scene at a time. The node's one job: give you the exact mask interval for the current scene, aligned to that scene's complete raw frame interval, plus its continuation overlap. White means generate; black means leave the source alone.
It exists because "mask the thing" in a multi-scene video is only correct if the mask covers the right frames. A tracked mask that follows a moving subject over a whole source video is useless if you paste the full timeline into a single scene's latent. This node looks at the current Chain Loop state, works out which interval the current scene occupies (including the overlap that carries continuity from the predecessor), and slices the mask to match.
Inputs and outputs
- state - the current state from H3 Chain Current Shot, which tells the node which scene it's in.
- mask - either one static mask (broadcast across the scene, FPS ignored) or a complete tracked mask timeline.
- source_fps - the FPS represented by a tracked mask batch, so the node can convert frame counts to the scene's 24-fps timeline correctly.
Outputs: scene_mask (the static mask broadcast or the tracked-mask slice for the current scene's complete raw interval), scene_mask_frames (how many mask frames were returned - handy sanity check), and status (a summary of the selected interval and whether it broadcast or sliced).
Where it fits
This is the front half of the masked-editing pipeline. The maintained masked-video-inpaint workflows chain it as: Loop Mask Slice (align the mask to the scene) → Loop Source AV Target (put the real source interval into the joint target) → Apply Target Mask (attach the composed video/audio denoise mask). Each of those three nodes does one narrow thing, and Mask Slice is the one that keeps the mask honest scene by scene. If your inpaint mask is drifting off the subject or bleeding into the wrong frames as the chain advances, the first suspect is the slice - wrong FPS, or a mask batch that wasn't actually tracked across the full source timeline.
It also plays well with outpainting and temporal edits where you only want H3 to regenerate part of the canvas: a generous static mask is the simple path (zero extra grow needed, per the docs' comparison against the MaskVidExperiments approach), while a tracked mask is what you reach for when the subject moves.
Install
From ComfyUI-MiniMaxH3-Contex-Loop. ComfyUI Manager → search the pack, or:
cd ComfyUI/custom_nodes
git clone https://github.com/ethanfel/ComfyUI-MiniMaxH3-Contex-Loop.git
Restart. No pip deps. The masked path needs a current ComfyUI with native Add Guide for MiniMax H3 (PR #15439) and the native per-token H3 AV mask support (PR #15375); on older builds the AV-mask continuation modes refuse to enable rather than half-work. H3 weights aren't bundled and are geofenced out of the US/EU/UK/South Korea under the Community License.
Gotchas
Two classic mistakes. First, feeding a tracked mask timeline without setting source_fps to the actual tracker FPS - the slice lands on the wrong frames and you'll spend an hour chasing a "mask drift" that's just a unit mismatch. Second, expecting a single static mask to behave like a tracked one across a long scene; for anything with real motion, track the mask and let this node slice it. And remember the mask convention is baked into the node's own docs: white = generate. Invert it and you'll preserve the thing you meant to regenerate.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| state | H3_CHAIN_STATE | Current state from H3 Chain Current Shot. | |
| mask | MASK | One static mask or a complete tracked mask timeline. White means generate. | |
| source_fps | FLOAT | 24.0000.001–1000 | FPS represented by a tracked mask batch. A single mask is broadcast and ignores FPS. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| scene_mask | MASK | Static mask broadcast or tracked-mask slice aligned to the current scene's complete raw frame interval. |
| scene_mask_frames | INT | Number of mask frames returned for the current scene. |
| status | STRING | Summary of the selected scene interval and whether the mask was broadcast or sliced. |