MiniMax H3 Video Frames Padding
17*n+5, because of course
- image
- mask
- image
- mask
- width
- height
- length
- input_length
MiniMax H3 is the July 2026 open-weight multimodal video model - audio and video in one latent, 17 frames per second of temporal stride, and a frame-count rule that looks like it was chosen by someone who hates round numbers: 17*n + 5. Valid counts are 5, 22, 39, 56, 73, 90... Every other count needs fixing before the model will touch it. This node is that fixer, and it's the H3-specific sibling of the same pack's Wan padding node.
The reason the grid exists is the model's architecture: H3's latent encodes a fixed number of frames per temporal token (17 of them), with 5 leftover frames in the layout - the same family of constraint that gives Wan its 4*n+1. The practical consequence is identical: feed H3 a 58-frame clip and you'll be staring at an error, or worse, a silent shape mismatch deep in the model. Padding is not optional.
How it works
Like its Wan sibling, the mechanism is deliberately dumb: repeat the last frame until the count lands on the grid. With target_frame_count left at 0, the node rounds your input up to the next 17*n+5. If you set an explicit target, it must itself be a valid H3 count and must not be shorter than the input. A matching mask is padded with the same repeated frame so mask and video stay in lockstep.
The inputs that matter
- image - your
IMAGEframe batch. - target_frame_count -
0(default) auto-rounds to the17*n+5grid. Set a number only if you need a specific exact length. - mask (optional) - padded identically to the image.
Outputs: image, mask, width, height, length (padded result), and input_length (what went in). The length/input_length pair is genuinely useful - wire them into a text or logging node to see how much padding your source actually needed, which tells you whether the source was sane to begin with.
How to install
Same pack as the rest of the H3 tooling - ComfyUI Turing Utils, listed as "comfyui-svdint4" in Manager:
cd ComfyUI/custom_nodes
git clone https://github.com/wjie98/comfyui-svdint4
cd comfyui-svdint4
python -m pip install -v --no-build-isolation -e ./kernel
This node is pure tensor logic, so it works off the Python install alone - but the H3 VAE and attention nodes in the same pack want the compiled kernel, so build it once and you're covered for everything. Restart after.
Where people get burned
The classic H3 newcomer mistake is thinking "close enough" - 57 frames is not 56, and the model will not forgive you. Second: don't use this node to stretch a clip by tens of frames. Repeating the final frame works beautifully for a 1-3 frame gap; beyond that you get a frozen tail the model has to smooth over. If you genuinely need a longer video, generate longer or trim to the valid grid instead of padding your way there.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_frame_count | INT | 00–16384 | Use 0 to round up to MiniMax H3's 17*n+5 frame grid. |
| maskopt | MASK | — |
Outputs (6)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |
| mask | MASK | — |
| width | INT | — |
| height | INT | — |
| length | INT | — |
| input_length | INT | — |