🔢 S42 CutFlow LTX Frame Calculator
The LTX frame-count trap, solved by one tiny calculator node
- frame_count
- fps
- duration_seconds
- fps_float
- info
LTX 2.3 does not accept arbitrary frame counts. It only accepts counts that fit the 8n+1 rule - 9, 17, 25, 33, 41, 49, all the way up to 257, 513, and beyond. Feed it 120 frames and your latent just fails, or you silently get a clip that's a different length than you planned. S42CF_LTXFrameCalc exists for exactly that one job: you tell it how long you want your video, it hands back the nearest valid frame count, ready to plug straight into EmptyLTXVLatentVideo.
It's part of S42 CutFlow's "LTX Bridge" group, the eight nodes the pack author (GeekyGhost) built to glue his video-editing suite onto the LTX 2.3 pipeline - guide frames, subject plates, audio prep, and this little number cruncher. In a long-form LTX workflow this is usually the first node you wire up, because every conditioning node downstream (guide frames, audio) needs to agree on how many frames you're generating.
What you actually set
Four inputs, and honestly only one of them demands thought:
- desired_duration (float, 0.1–30s) - how many seconds of video you want. This is the one you'll touch every time.
- fps (int, 8–60, default 24) - LTX 2.3's default is 24fps, and the tooltip reminds you of that. Change it only if your pipeline runs at another rate.
- round_mode -
nearest(closest valid count),round_up(never shorter than your target), orround_down(never longer). Defaultnearestis right for almost everyone; pickround_upif you absolutely need at least N seconds of usable footage. - max_frames (int, 9–513, default 257) - a VRAM ceiling. The tooltip gives you the cheat sheet: 121 frames ≈ 5s, 257 ≈ 10.7s, 513 ≈ 21.4s at 24fps. The higher you go, the more VRAM the generation eats, so if you're on a 12GB card this is your sanity limit.
The math is nothing fancy - it takes duration × fps, rounds to the nearest number that satisfies (n−1) % 8 == 0, and clamps to your max_frames. The source even prints a rough VRAM estimate (about 0.04GB per frame at 768×512) into its info string, which is a nice touch for the "will this fit?" question before you commit.
Outputs and where they go
The output that matters is frame_count (INT) - wire it into the frame-count input of EmptyLTXVLatentVideo. There are also fps (INT) and fps_float (FLOAT) outputs you can pipe into nodes that want the rate, a duration_seconds output so you know what you actually got after rounding, and an info string that spells out the whole conversion. If you want to see the arithmetic, hover the info output and read the line like 5.0s × 24fps = 120f → 121f (8×15+1) = 5.04s.
Installing it
S42 CutFlow installs once for all its nodes. Easiest via ComfyUI Manager (search S42 CutFlow), or:
cd ComfyUI/custom_nodes/
git clone https://github.com/GeekyGhost/S42-CutFlow.git
# then, Windows portable:
.\python_embeded\python.exe -m pip install -r S42-CutFlow\requirements.txt
# or Linux/venv:
pip install -r S42-CutFlow/requirements.txt
Restart ComfyUI and you should see a [S42 CutFlow] Loaded ... nodes line in the console. The only real dependency is OpenCV, which the requirements file pulls in as opencv-python-headless.
Gotchas
The classic failure this node prevents: you hand-typed 120 into the latent node and the run errors out or you get the "must be 8n+1" complaint. Just route your desired duration through here instead of doing mental math. One thing worth knowing before you trust the info VRAM estimate too hard - it's a rough per-frame guess, not a measurement of your actual prompt/checkpoint, so treat it as "probably fits" rather than gospel. And if you're pushing the 513-frame end, remember LTX 2.3's practical single-pass limit is around 10–20 seconds anyway; past that you're into segment-splitting territory (which S42 CutFlow also has a node for).
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| desired_duration | FLOAT | 5.00.1–30 | Desired video duration in seconds. |
| fps | INT | 248–60 | Target frame rate. LTX 2.3 default is 24fps. |
| round_mode | COMBO | nearest | How to round to valid 8n+1 frame count. 'round_up' = never shorter than desired. 'round_down' = never longer. 'nearest' = closest match. |
| max_frames | INT | 2579–513 | Maximum frame count. 121=~5s, 257=~10.7s, 513=~21.4s at 24fps. Higher needs more VRAM. |
Outputs (5)
| Name | Type | Description |
|---|---|---|
| frame_count | INT | — |
| fps | INT | — |
| duration_seconds | FLOAT | — |
| fps_float | FLOAT | — |
| info | STRING | — |