Nodes/ComfyUi-MpiNodes/Mpi H3 Length
ComfyUI Node

Mpi H3 Length

The frame-count calculator MiniMax H3 forces you to need

By MadPonyInteractive·Created 11 months ago·Updated 5 days ago· 3
Mpi H3 Length
    • frames
    • seconds
    • in_trained_range
    seconds5.0

    MiniMax H3 is a 33B open-weight video model that's genuinely good - and it has a genuinely annoying quirk: it only generates clips whose frame count satisfies n % 17 == 5, at 24 fps. That means most whole-second durations are physically unreachable. Want 2 seconds? The grid gives you 2.33s. Want 4? You get 4.46. Only 8 seconds lands exactly on a whole second. MpiH3Length exists so you never have to think about this arithmetic again: type the duration you want, and it hands you the valid frame count to feed the H3 node's length input - plus the true duration you'll actually get.

    How it works

    One input: seconds (a float, 0.2–150). The node rounds it to the nearest valid H3 frame count - i.e. the nearest number of the form 17k + 5 - then outputs:

    • frames - the valid frame count, for the H3 node's length socket.
    • seconds - the true duration those frames give you at 24 fps. This is the number you should display and plan around, because it's what you'll actually get.
    • in_trained_range - BOOLEAN. False outside the 124–362 frame band (roughly 5.2–15.1s), where the model runs but was never trained. Handy for knowing you're pushing past what the model was tuned for.

    The key design choice is "nearest, not up." ComfyUI's core H3 node snaps durations up to the next valid frame count, which maximises the error - 4s asks for 96 frames and gets 107 (4.46s) when 90 (3.75s) is closer. This node snaps to the nearest valid value instead, which is never worse and usually much closer. Because the result is already valid, feeding it through core's own snap leaves it alone.

    The inputs that matter

    • seconds - what you want. The seconds output is the truth.

    Where people get burned

    The trap is expecting the number you typed to come back. It won't - H3 can't do most of them. The correct workflow is: decide your duration, wire this node's frames into the H3 length input, and display/plan around its seconds output, not the widget you typed. That's the whole reason the node returns both. Also watch in_trained_range: 5s (124 frames) is inside the trained band, but asking for 3s (72 frames) or 20s runs the model outside what it was trained on - usable, but don't expect the same quality you'd get in the trained range.

    Install

    From the MadPonyInteractive/ComfyUi-MpiNodes pack - the same pack that powers the author's Cubric Vision app. ComfyUI Manager → search ComfyUi-MpiNodes (publisher mad-pony-interactive), install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/MadPonyInteractive/ComfyUi-MpiNodes
    

    then restart. No extra dependencies - it's arithmetic on a frame grid. Note H3 itself is a separate, multi-gigabyte model download from HuggingFace (MiniMaxAI/MiniMax-H3), and as of the community-licence terms, the weights are geofenced out of the US, EU, UK and South Korea - worth checking before you plan a project around it. The pack is AGPL-3.0 (≤ 1.2.6 MIT).

    The verdict

    It's a 17k+5 frame calculator, which sounds absurdly niche until you're standing in front of an H3 workflow wondering why the 4-second clip you asked for came out at 4.46 seconds. Then it's the node that saves you from hand-computing frame grids. Pair it with MpiH3References (feed its frames into that node's length) and your H3 workflow stops lying to you about duration.

    CategoryMpiNodes/Utils

    Inputs (1)

    NameTypeDefaultDescription
    secondsFLOAT5.00.2–150Wanted duration. H3 can only land on a 17k+5 frame grid at 24 fps, so the `seconds` output is what you will actually get.

    Outputs (3)

    NameTypeDescription
    framesINT
    secondsFLOAT
    in_trained_rangeBOOLEAN