Nodes/comfyui-AGSoft/🎬 AGSoft LTX Base
ComfyUI Node

🎬 AGSoft LTX Base

LTX video math you no longer have to do by hand

By Art-xmaster·Created 12 months ago·Updated a day ago· 23
🎬 AGSoft LTX Base
    • width
    • height
    • frame_rate_int
    • frame_rate_float
    • frame_count
    modePreset
    preset1280×704 (16:9)
    invert_orientationfalse
    custom_width1280
    custom_height704
    megapixels_value1.0
    aspect_ratio16:9
    frame_rate_float25.00
    frame_count_sourceFrom seconds
    length_seconds5
    frame_count129

    LTX video models are great until you have to remember their parameter rules: frame dimensions must be multiples of 32, frame count has to follow the 1, 9, 17, 25… sequence (N×8+1), and the FPS has to survive as both an int and a float. Miss any of those and the sampler silently fails or crops your clip. 🎬 AGSoft LTX Base exists so you type "1280×704, 5 seconds, 25 fps" and get back exactly the four numbers an LTX sampler actually wants.

    The pack's README frames it as a "universal video parameter calculator for LTX models," and that's precisely what it is: a sizing and formatting node, not a sampler. You put it between your thinking and your LTX Video Sampler.

    How it works

    Three mode options for the frame size:

    • Preset (default) - named resolutions, with 1280×704 (16:9) as the default. A long menu covers square, photo (3:2), standard (4:3), and cinematic (16:9) sizes, all pre-checked to be multiples of 32.
    • Custom - your own custom_width/custom_height (defaults 1280×704), which get normalized to the 32-grid.
    • Megapixels - megapixels_value plus an aspect_ratio dropdown, sized automatically.

    invert_orientation swaps width/height (useful when you're generating vertical video from a horizontal reference) and works in Preset and Custom modes.

    Frame count comes two ways via frame_count_source: "From seconds" (pick length_seconds, the node derives the count) or manual (frame_count, default 129). Either way the count snaps to the N×8+1 sequence - 1, 9, 17, 25, 33… - so 5 seconds at 25fps becomes 129, not 125. The rounding is up, so you never undershoot.

    frame_rate_float (default 25) feeds both the int and float FPS outputs.

    The outputs

    width, height, frame_rate_int, frame_rate_float, frame_count - five numbers, every one of them guaranteed to satisfy LTX's constraints. That's the whole value proposition: no more "why did it crop my video" debugging sessions.

    Installing it

    Pack standard: ComfyUI Manager → search comfyui-AGSoft → install, restart. Or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Art-xmaster/comfyui-AGSoft.git
    

    Pure math, no models, no dependencies - the node ships with the pack and needs nothing else.

    Common issues

    The realistic mistakes are all upstream of this node. If your clip still fails, check whether you're feeding an odd length_seconds (the derived count will round up to the 8N+1 grid, so 5s at 25fps yields 129 frames - plan your video length accordingly). Also note this node formats the numbers; it doesn't build your latent or set up the model. And one thing that bites people new to LTX generally: LTX-2 is a Lightricks model under the LTX-2 Community License - free under $10M annual revenue but share-alike and with a restrictive acceptable-use clause. The node is MIT; the model isn't; keep the two straight before you ship anything commercial from it.

    CategoryAGSoft/Video

    Inputs (11)

    NameTypeDefaultDescription
    modeCOMBOPresetFrame 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 соблюдается. Инверсия НЕ применяется (соотношение уже задаёт ориентацию).
    presetCOMBO1280×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 • 768×1344 (9:16) — vertical video (after invert) All sizes are multiples of 32 — safe for LTX models. 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 горизонтальное, киноформат • 768×1344 (9:16) — вертикальное видео (после инверсии) Все размеры кратны 32 — безопасно для моделей LTX. Сгруппированы по соотношениям для удобной навигации: 1:1 → 3:2 → 4:3 → 16:9 Используйте 'invert_orientation' для смены ширины и высоты.
    invert_orientationBOOLEANfalseSwap 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_widthINT128064–8192Custom 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_heightINT70464–8192Custom 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_valueFLOAT1.00.1–8Target 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 ═══════════════════════════════════════ Целевое разрешение в мегапикселях (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
    aspect_ratioCOMBO16:9Target 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_rate_floatFLOAT25.000.01–120Frame rate in frames per second (FPS). Standard values: • 23.976 — cinema (NTSC film) • 24.0 — cinema (film standard) • 25.0 — PAL TV (Europe, Russia) • 29.97 — NTSC TV (USA, Japan) • 30.0 — internet video, gaming • 50.0 — smooth motion, slow-mo source • 60.0 — high frame rate, gaming content Two outputs provided: • frame_rate_int — integer part (e.g. 25) • frame_rate_float — full value with 2 decimals (e.g. 25.0, 29.97) Used in frame count calculation: frames = ((sec × FPS_int − 1 + 7) // 8) × 8 + 1 ═══════════════════════════════════════ Частота кадров (FPS). Стандартные значения: • 23.976 — кино (NTSC) • 24.0 — кино (стандарт) • 25.0 — PAL ТВ (Европа, Россия) • 29.97 — NTSC ТВ (США, Япония) • 30.0 — интернет-видео, игры • 50.0 — плавное движение, источник для slow-mo • 60.0 — высокий FPS, игровой контент Два выхода: • frame_rate_int — целая часть (например, 25) • frame_rate_float — полное значение с 2 знаками (например, 25.0, 29.97) Участвует в расчёте кадров: кадры = ((сек × FPS_int − 1 + 7) // 8) × 8 + 1
    frame_count_sourceCOMBOFrom secondsHow to determine the total number of frames. • From seconds — automatic calculation using the formula: ((length_seconds × FPS_int − 1 + 7) // 8) × 8 + 1 Example: 5 sec × 25 FPS = 125 → aligned to 129 frames. The result always follows the sequence: 1, 9, 17, 25, 33... • Manual — you specify the exact frame count. The value is automatically aligned UP to the nearest valid number in the sequence 1, 9, 17, 25... Example: you enter 100 → output will be 105 (nearest 8N+1). HINT: Use 'From seconds' for quick setup. Use 'Manual' for precise control over exact frame count (e.g. for looped animations). ═══════════════════════════════════════ Способ определения общего количества кадров. • From seconds — автоматический расчёт по формуле: ((length_seconds × FPS_int − 1 + 7) // 8) × 8 + 1 Пример: 5 сек × 25 FPS = 125 → выравнивается до 129 кадров. Результат всегда в последовательности: 1, 9, 17, 25, 33... • Manual — вы указываете точное количество кадров. Значение автоматически выравнивается ВВЕРХ до ближайшего допустимого числа в последовательности 1, 9, 17, 25... Пример: вводите 100 → на выходе будет 105 (ближайшее 8N+1). СОВЕТ: используйте 'From seconds' для быстрой настройки. Используйте 'Manual' для точного контроля (например, для зацикленных анимаций).
    length_secondsINT51–3600Desired video duration in seconds. Used ONLY when frame_count_source = 'From seconds'. The actual frame count is calculated as: ((length_seconds × FPS_int − 1 + 7) // 8) × 8 + 1 Examples: • 3 sec × 24 FPS → 71 frames (not 72!) • 5 sec × 25 FPS → 129 frames • 10 sec × 30 FPS → 297 frames Range: 1 to 3600 seconds (1 hour). Note: the output frame count will be slightly different from seconds × FPS due to alignment to the 8N+1 sequence. This is REQUIRED by LTX models. ═══════════════════════════════════════ Желаемая длительность видео в секундах. Используется ТОЛЬКО при frame_count_source = 'From seconds'. Количество кадров рассчитывается по формуле: ((length_seconds × FPS_int − 1 + 7) // 8) × 8 + 1 Примеры: • 3 сек × 24 FPS → 71 кадр (не 72!) • 5 сек × 25 FPS → 129 кадров • 10 сек × 30 FPS → 297 кадров Диапазон: 1 – 3600 секунд (1 час). Заметьте: итоговое число кадров будет немного отличаться от секунды × FPS из-за выравнивания под 8N+1. Это ТРЕБОВАНИЕ моделей LTX.
    frame_countINT1291–99999Exact 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 LTX sequence: 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97... Formula: N × 8 + 1 (where N = 0, 1, 2, 3...) Examples: • You enter: 100 → Output: 105 (nearest 8N+1 >= 100) • You enter: 129 → Output: 129 (already valid) • You enter: 1 → Output: 1 (minimum) • You enter: 200 → Output: 201 (nearest 8N+1 >= 200) Range: 1 to 99999 frames. HINT: Typical LTX videos range from 33 to 257 frames. Common values: 129 (5 sec @25fps), 161, 193. ═══════════════════════════════════════ Точное количество кадров для Manual режима. Используется ТОЛЬКО при frame_count_source = 'Manual'. Значение автоматически выравнивается ВВЕРХ до ближайшего допустимого числа из последовательности LTX: 1, 9, 17, 25, 33, 41, 49, 57, 65, 73, 81, 89, 97... Формула: N × 8 + 1 (где N = 0, 1, 2, 3...) Примеры: • Вводите: 100 → На выходе: 105 (ближайшее 8N+1 >= 100) • Вводите: 129 → На выходе: 129 (уже допустимое) • Вводите: 1 → На выходе: 1 (минимум) • Вводите: 200 → На выходе: 201 (ближайшее 8N+1 >= 200) Диапазон: 1 – 99999 кадров. СОВЕТ: типичные LTX видео — от 33 до 257 кадров. Частые значения: 129 (5 сек @25fps), 161, 193.

    Outputs (5)

    NameTypeDescription
    widthINT
    heightINT
    frame_rate_intINT
    frame_rate_floatFLOAT
    frame_countINT