Nodes/IAMCCS-nodes/LTX-2 Ensure Minimum Frames
ComfyUI Node

LTX-2 Ensure Minimum Frames

LTX-2 Ensure Minimum Frames

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
LTX-2 Ensure Minimum Frames
  • images
  • images
  • frames
  • report
min_frames25
moderepeat_last
ltx_frames_fixup

Some LTX-2 workflows need a video to be at least N frames long - an I2V clip that's too short gives the model almost no temporal runway, and a segment that underruns its slot in a multi-segment pipeline can throw off everything downstream. This node is the guardrail: give it an IMAGE batch and a floor, and it either pads the batch up to that floor or screams at you. It's the "minimum" sibling of the pack's EnsureFrames8nPlus1, and the two are designed to be stacked.

How it works

EnsureMinFrames computes target = max(current_frames, min_frames). If you're already above the floor, it returns your images untouched - it's a no-op pass-through, so you can drop it into a graph permanently without worrying it'll mangle things on the good passes.

When padding is needed, the default repeat_last mode tiles your final frame until the batch hits the target. That's the least-bad way to pad a video: a frozen tail reads as "camera held on the last shot," which is far less jarring than repeating frame zero or inserting a black frame. Alternatively, mode=error raises a ValueError instead of padding - that's the tripwire you want in an automated loop, where silent padding could cover up a broken upstream node producing too-few frames.

There's one more knob worth knowing about: ltx_frames_fix. After the min is satisfied, this re-rounds the result to the LTX-2 8n+1 rule (up, down, nearest, or none to skip). So this one node can do both jobs - hit your minimum and stay encode-legal - which is why the pack's FrameCountValidator math shows up inside it rather than you wiring three nodes to do it.

The inputs and outputs that matter

  • images - the batch to enforce the floor on.
  • min_frames - your floor. Default 25; set it to whatever your sampler or segment plan actually requires.
  • mode - repeat_last (default) or error.
  • ltx_frames_fix - none / up (default) / down / nearest. It's on by default, so your output is 8n+1-legal without you asking; switch to none only if you're handling that rounding elsewhere.

Outputs are images (possibly padded), frames (the final count as an INT), and report (a STRING recording what changed). The report is genuinely useful in a long loop - it tells you when a segment silently got padded versus when it was already fine.

Installing it

It's part of the IAMCCS-nodes pack, so one install covers the whole LTX-2 toolbox. Via ComfyUI Manager, search "IAMCCS" and install; or:

cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git

Restart, and you'll find it under IAMCCS/LTX-2. No models, no extra pip packages - it's pure tensor manipulation.

Common issues

The usual gotcha is stacking it with EnsureFrames8nPlus1 in the wrong order. If you run the 8n+1 fix first and it cropped frames (say you used crop_end), your floor check then pads back up - so set the floor first, then the 8n+1 rounding, so the ltx_frames_fix here does the final word. And remember: repeat_last is a crutch, not a fix. If you're padding more than a few frames, your source clip is too short and the model will happily show you a frozen tail - check the report string before you blame the sampler.

CategoryIAMCCS/LTX-2

Inputs (4)

NameTypeDefaultDescription
imagesIMAGE
min_framesINT251–1000000
modeCOMBOrepeat_last2 options: repeat_last, error
ltx_frames_fixCOMBOup4 options: none, up, down, nearest

Outputs (3)

NameTypeDescription
imagesIMAGE
framesINT
reportSTRING