XB-BOX - 🌊 海螺H3视频参数
Hailuo H3 resolution and frame math, without the mental arithmetic
- Width
- Height
- Frames
- 参考图放大系数
Hailuo (海螺) H3 - MiniMax's video model, and the same model family behind the MiniMax H3 nodes you'll see in this ecosystem - expects resolutions computed a specific way: pick a megapixel budget and an aspect ratio, and it derives width and height from them, rounded to a multiple. Do that by hand once and you'll remember why you stopped. XB_HailuoH3VideoParams does the formula for you and also computes the frame count from a duration, so everything the sampler wants comes out of one node.
If you're feeding a MiniMax H3 reference-encode + sampler pipeline, this is the parameter front-end that keeps your resolution legal and your frame count sane. It's the H3-flavored sibling of the pack's general video params master.
How it works
The resolution half is a faithful port of the official ResolutionSelector formula: total pixels = megapixels × 1024², then scale = √(pixels ÷ (w_ratio × h_ratio)), then round(ratio × scale / multiple) × multiple. Set megapixels to 1 and it gives you roughly 1024² worth of pixels at whatever ratio you picked; crank it to 4 and you're asking for a 2048-ish square. The multiple (default 32, range 8–128) is the rounding granularity - the tradeoff is exactness of the ratio versus how "legal" the resolution is for the model. Stick with 32; it's the default for a reason.
The frame half is simpler: duration (4–15 seconds) gets converted to frames at a 24fps baseline, then snapped to a specific frame pattern (safe_len formula in the code) that keeps the length compatible with the model's expectations. The frames_display field is a readout of the computed frame count as you adjust.
There's a fourth piece: scale_factor - the tooltip says it feeds the "MiniMax H3 reference encoder" to scale reference images. It's passed straight through as a FLOAT output for whatever node wants it.
The inputs that matter
- aspect_ratio - ten presets from 1:1 to 21:9, default
16:9 (Widescreen). The two(Photo)and standard variants cover the common framing choices. - megapixels - 0.1–16, default 1.0. The resolution budget.
- multiple - default 32. Rounding granularity; leave it.
- duration - 4–15s. Becomes the Frames output.
The outputs
Four wires: Width, Height, Frames, and 参考图放大系数 (the reference-image scale factor, a FLOAT passthrough). Width/Height/Frames feed your latent or sampler; the scale factor goes to the reference encode stage if your workflow uses one.
Install
Standard XB_ToolBox install (Manager search XB_ToolBox, or git clone into custom_nodes, restart). No models, no deps. The only real pitfall is treating megapixels as "resolution number" - 1.0 isn't 1024, it's a megapixel budget, and the actual pixel dimensions depend on the ratio you chose. And if the computed Frames looks off for a 15s clip, remember it's snapped to the model's frame rule, not a straight duration × 24.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| aspect_ratio | COMBO | 16:9 (Widescreen) | 10 options: 1:1 (Square), 2:3 (Portrait Photo), 3:2 (Photo), 3:4 (Portrait Standard), 4:5 (Portrait Tall), 4:3 (Standard), +4 |
| megapixels | FLOAT | 1.00.1–16 | — |
| multiple | INT | 328–128 | — |
| frames_display | STRING | Frames: 0 | — |
| duration | INT | 84–15 | — |
| scale_factor | FLOAT | 1.01–5 | 参考图放大系数 — 接入「MiniMax H3 参考编码」的参考值放大 |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| Width | INT | — |
| Height | INT | — |
| Frames | INT | — |
| 参考图放大系数 | FLOAT | — |