🎬 AGSoft MiniMax Base
The parameter calculator that keeps MiniMax H3 samplers happy
- width
- height
- fps_int
- fps_float
- total_frames
🎬AGSoft MiniMax Base isn't a video effect at all - it's a resolution and frame-count calculator, and it exists because MiniMax H3 is picky about numbers. H3, like its LTX ancestors, has hard format rules: width and height must be multiples of 32, the frame count has to land on the sequence 5, 22, 39, 56, 73... (that's 17×N+5), and the frame rate is fixed at 24fps. Feed it a "clean" 1280x720 at 100 frames and the sampler will error out or silently misbehave. This node does the math so you don't have to, then hands the results to your sampler inputs.
If you've ever fought an LTX-family workflow complaining about tensor shapes, you know the pain this removes. The node is a small, pure-Python utility - no models, no VRAM, nothing heavy - and the source spells out its job: "use this node before connecting to MiniMax H3 sampler nodes."
How it works
Three size modes:
Preset- pick from ~40 predefined sizes grouped by aspect ratio (square, photo, standard, cinema), all already multiples of 32. This is the "stop thinking" mode and the default.Custom- typecustom_width/custom_heightand they get rounded up to the nearest multiple of 32 (the source example: 100×100 → 128×128).Megapixels- givemegapixels_value(target megapixels) plus anaspect_ratio, and it computes both dimensions.
invert_orientation swaps width and height, which works in Preset and Custom modes (not Megapixels - there the aspect ratio already defines orientation).
Frame count has its own two modes via frame_count_source: From seconds (set length_seconds, the node derives a frame count) or Manual (set frame_count directly). Either way the result is snapped to the 17×N+5 sequence with a minimum of 5.
Outputs
These are the values you wire into the sampler or empty-latent nodes:
width/height(INT)fps_int(24) andfps_float(24.0) - some nodes want one, some the other, so you get both.total_frames(INT) - the snapped frame count.
Install
Part of the comfyui-AGSoft pack. ComfyUI Manager → search "comfyui-AGSoft" → Install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/Art-xmaster/comfyui-AGSoft
Restart. No models to download for this node - it's arithmetic.
Worth knowing: the sequence 17×N+5 and the 32-multiple rule aren't AGSoft inventions, they're the model's native constraints. If a workflow you downloaded has a custom resolution widget that produced a weird number of frames and it keeps failing, run it through this node and let it snap things before you blame the sampler.
Inputs (10)
| Name | Type | Default | Description |
|---|---|---|---|
| mode | COMBO | Preset | Frame size selection mode. • Preset — choose from 40 predefined sizes grouped by aspect ratio. Aspect ratios: 1:1 (Square), 3:2 (Photo), 4:3 (Standard), 16:9 (Cinema). All sizes are already multiples of 32. Invert orientation supported. • Custom — manually enter width and height in pixels. Values are automatically rounded UP to the nearest multiple of 32. Example: 100×100 → 128×128. Invert orientation supported. • Megapixels — specify target resolution in megapixels + aspect ratio. Width and height calculated automatically, rounded to multiples of 32. Invert orientation NOT applied (aspect ratio defines orientation). ═══════════════════════════════════════ Режим выбора размера кадра. • Preset — выбор из 40 готовых размеров по соотношениям сторон. Форматы: 1:1 (Квадрат), 3:2 (Фото), 4:3 (Стандарт), 16:9 (Кино). Все размеры уже кратны 32. Доступна инверсия сторон. • Custom — ручной ввод ширины и высоты в пикселях. Значения автоматически округляются ВВЕРХ до кратности 32. Пример: 100×100 → 128×128. Доступна инверсия сторон. • Megapixels — задаёте мегапиксели + соотношение сторон. Размеры рассчитываются автоматически, кратность 32 соблюдается. Инверсия НЕ применяется (соотношение уже задаёт ориентацию). |
| preset | COMBO | 1280×704 (16:9) | Predefined frame size with aspect ratio label. Format: WIDTH×HEIGHT (ASPECT_RATIO) Examples: • 1024×1024 (1:1) — square, 1 megapixel • 1280×704 (16:9) — HD landscape, cinema format • 704×1280 (9:16) — vertical video (after invert) All sizes are multiples of 32 — safe for MiniMax H3. Grouped by aspect ratio for easy navigation: 1:1 → 3:2 → 4:3 → 16:9 Use 'invert_orientation' to swap width↔height if needed. ═══════════════════════════════════════ Готовый размер кадра с меткой соотношения сторон. Формат: ШИРИНА×ВЫСОТА (СООТНОШЕНИЕ) Примеры: • 1024×1024 (1:1) — квадрат, 1 мегапиксель • 1280×704 (16:9) — HD горизонтальное, киноформат • 704×1280 (9:16) — вертикальное видео (после инверсии) Все размеры кратны 32 — безопасно для MiniMax H3. Сгруппированы по соотношениям для удобной навигации: 1:1 → 3:2 → 4:3 → 16:9 Используйте 'invert_orientation' для смены ширины и высоты. |
| invert_orientation | BOOLEAN | false | Swap width and height values. Use cases: • Quickly create vertical video from landscape preset. Example: 1280×704 → 704×1280 (9:16 vertical) • Swap custom dimensions without re-entering values. Works in: Preset and Custom modes. Does NOT work in: Megapixels mode (aspect ratio defines orientation). ═══════════════════════════════════════ Поменять ширину и высоту местами. Сценарии использования: • Быстрое создание вертикального видео из горизонтального пресета. Пример: 1280×704 → 704×1280 (вертикальное 9:16) • Смена размеров без повторного ввода значений. Работает в: Preset и Custom. НЕ работает в: Megapixels (соотношение уже задаёт ориентацию). |
| custom_width | INT | 86464–8192 | Custom frame width in pixels (used in Custom mode). • Automatically rounded UP to nearest multiple of 32. Example: 100 → 128, 1900 → 1920, 1920 → 1920. • Minimum: 64 pixels. • Maximum: 8192 pixels. • Step: 32 (for convenience). ═══════════════════════════════════════ Своя ширина кадра в пикселях (режим Custom). • Автоматически округляется ВВЕРХ до кратности 32. Пример: 100 → 128, 1900 → 1920, 1920 → 1920. • Минимум: 64 пикселя. • Максимум: 8192 пикселя. • Шаг: 32 (для удобства). |
| custom_height | INT | 48064–8192 | Custom frame height in pixels (used in Custom mode). • Automatically rounded UP to nearest multiple of 32. Example: 100 → 128, 1080 → 1088, 1088 → 1088. • Minimum: 64 pixels. • Maximum: 8192 pixels. • Step: 32 (for convenience). ═══════════════════════════════════════ Своя высота кадра в пикселях (режим Custom). • Автоматически округляется ВВЕРХ до кратности 32. Пример: 100 → 128, 1080 → 1088, 1088 → 1088. • Минимум: 64 пикселя. • Максимум: 8192 пикселя. • Шаг: 32 (для удобства). |
| megapixels_value | FLOAT | 1.00.1–8 | Target resolution in megapixels (MP) for Megapixels mode. • 1.0 MP = 1,000,000 pixels (e.g. ~1024×1024). • Range: 0.1 to 8.0 MP. • Step: 0.1 MP (10,000 pixels). • Width and height calculated automatically: – Based on selected aspect_ratio. – Rounded to nearest multiple of 32. Examples: • 0.15 MP + 16:9 → ~512×288 • 1.0 MP + 1:1 → ~1024×1024 • 2.0 MP + 16:9 → ~1920×1088 (2K) ═══════════════════════════════════════ Целевое разрешение в мегапикселях (MP) для режима Megapixels. • 1.0 MP = 1 000 000 пикселей (например, ~1024×1024). • Диапазон: 0.1 – 8.0 MP. • Шаг: 0.1 MP (10 000 пикселей). • Ширина и высота рассчитываются автоматически: – На основе выбранного aspect_ratio. – Округляются до кратности 32. Примеры: • 0.15 MP + 16:9 → ~512×288 • 1.0 MP + 1:1 → ~1024×1024 • 2.0 MP + 16:9 → ~1920×1088 (2K) |
| aspect_ratio | COMBO | 16:9 | Target aspect ratio for Megapixels mode. Available ratios and typical use: • 1:1 — square, social media (Instagram) • 3:2 — classic photo, 35mm film • 2:3 — vertical photo, portrait • 4:3 — standard monitor, iPad • 3:4 — vertical standard • 16:9 — widescreen, YouTube, TV, cinema • 9:16 — vertical video, Stories, Reels, Shorts • 21:9 — ultrawide, cinematic • 9:21 — vertical ultrawide Final size = closest match to target MP while keeping this ratio. All sizes are multiples of 32. ═══════════════════════════════════════ Целевое соотношение сторон для режима Megapixels. Доступные форматы и их применение: • 1:1 — квадрат, соцсети (Instagram) • 3:2 — классическое фото, 35мм плёнка • 2:3 — вертикальное фото, портрет • 4:3 — стандартный монитор, iPad • 3:4 — вертикальный стандарт • 16:9 — широкий экран, YouTube, ТВ, кино • 9:16 — вертикальное видео, Stories, Reels, Shorts • 21:9 — сверхширокий, кинематографичный • 9:21 — вертикальный сверхширокий Итоговый размер — ближайший к целевому MP при данном соотношении. Все размеры кратны 32. |
| frame_count_source | COMBO | From seconds | How to determine the total number of frames. • From seconds — automatic calculation using the formula: max(5, round(sec×24)) + (5 - (max(5, round(sec×24)) % 17)) % 17 Example: 10 sec × 24 FPS = 240 → aligned to 243 frames. The result always follows the sequence: 5, 22, 39, 56, 73... • Manual — you specify the exact frame count. The value is automatically aligned UP to the nearest valid number in the sequence 5, 22, 39, 56... Example: you enter 100 → output will be 107. HINT: Use 'From seconds' for quick setup. Use 'Manual' for precise control over exact frame count (e.g. for looped animations). ═══════════════════════════════════════ Способ определения общего количества кадров. • From seconds — автоматический расчёт по формуле: max(5, round(сек×24)) + (5 - (max(5, round(сек×24)) % 17)) % 17 Пример: 10 сек × 24 FPS = 240 → выравнивается до 243 кадров. Результат всегда в последовательности: 5, 22, 39, 56, 73... • Manual — вы указываете точное количество кадров. Значение автоматически выравнивается ВВЕРХ до ближайшего допустимого числа в последовательности 5, 22, 39, 56... Пример: вводите 100 → на выходе будет 107. СОВЕТ: используйте 'From seconds' для быстрой настройки. Используйте 'Manual' для точного контроля (например, для зацикленных анимаций). |
| length_seconds | FLOAT | 51–60 | Desired video duration in seconds. Used ONLY when frame_count_source = 'From seconds'. Can be driven by an external Float node (duration socket). The frame count is calculated as: max(5, round(sec×24)) + (5 - (max(5, round(sec×24)) % 17)) % 17 Examples: • 5 sec × 24 FPS → 124 frames • 10 sec × 24 FPS → 243 frames • 15 sec × 24 FPS → 362 frames Range: 1 to 60 seconds (MiniMax H3 clip limit). Note: the output frame count will be slightly different from seconds × 24 due to alignment to the 17N+5 sequence. This is REQUIRED by MiniMax H3. ═══════════════════════════════════════ Желаемая длительность видео в секундах. Используется ТОЛЬКО при frame_count_source = 'From seconds'. Можно подключить внешний Float-узел (сокет duration). Количество кадров рассчитывается по формуле: max(5, round(сек×24)) + (5 - (max(5, round(сек×24)) % 17)) % 17 Примеры: • 5 сек × 24 FPS → 124 кадра • 10 сек × 24 FPS → 243 кадра • 15 сек × 24 FPS → 362 кадра Диапазон: 1 – 60 секунд (лимит клипа MiniMax H3). Заметьте: итоговое число кадров будет немного отличаться от секунды × 24 из-за выравнивания под 17N+5. Это ТРЕБОВАНИЕ MiniMax H3. |
| frame_count | INT | 1245–99999 | Exact frame count for Manual mode. Used ONLY when frame_count_source = 'Manual'. The value is automatically aligned UP to the nearest valid number in the MiniMax H3 sequence: 5, 22, 39, 56, 73, 90, 107, 124... Formula: 17 × N + 5 (where N = 0, 1, 2, 3...), minimum 5. Examples: • You enter: 100 → Output: 107 (nearest 17N+5 >= 100) • You enter: 124 → Output: 124 (already valid) • You enter: 5 → Output: 5 (minimum) • You enter: 200 → Output: 209 (nearest 17N+5 >= 200) Range: 5 to 99999 frames. HINT: typical H3 videos: 124 (5 sec @24fps), 243 (10 sec @24fps). ═══════════════════════════════════════ Точное количество кадров для Manual режима. Используется ТОЛЬКО при frame_count_source = 'Manual'. Значение автоматически выравнивается ВВЕРХ до ближайшего допустимого числа из последовательности MiniMax H3: 5, 22, 39, 56, 73, 90, 107, 124... Формула: 17 × N + 5 (где N = 0, 1, 2, 3...), минимум 5. Примеры: • Вводите: 100 → На выходе: 107 (ближайшее 17N+5 >= 100) • Вводите: 124 → На выходе: 124 (уже допустимое) • Вводите: 5 → На выходе: 5 (минимум) • Вводите: 200 → На выходе: 209 (ближайшее 17N+5 >= 200) Диапазон: 5 – 99999 кадров. СОВЕТ: типичные значения H3: 124 (5 сек @24fps), 243 (10 сек @24fps). |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| width | INT | — |
| height | INT | — |
| fps_int | INT | — |
| fps_float | FLOAT | — |
| total_frames | INT | — |