Nodes/ComfyUI-Przewodo-Utils/LTX-2 Key Frame Indexes
ComfyUI Node

LTX-2 Key Frame Indexes

Tell the model exactly which frames are your keyframes

By przewodo·Created about a year ago·Updated 4 months ago· 4
LTX-2 Key Frame Indexes
  • image
  • Indexes
total_frames

LTX-2's whole trick is keyframe conditioning: you hand it a set of reference frames - first frame, maybe a middle frame, maybe an end frame - and it fills in the video between them. The catch is the model wants to know which frame positions those references map to, and that's a string of indexes you have to produce. Doing that arithmetic by hand, then retyping it every time you change the length, is exactly the kind of busywork that breeds errors. This node does it for you.

You feed it the images you're using as keyframes plus the total frame count of the video, and it returns a comma-separated string of frame indexes, evenly spread across the timeline - ready to drop into the keyframe index input of an LTX-2 workflow.

How it works

The math is deliberately simple: space your keyframes evenly, put the first at frame 0 and the last at the final frame, and keep the steps whole-numbered.

  • The node counts how many images you passed in.
  • It computes step = (total_frames - 1) / (number_of_images - 1).
  • It generates indexes 0, step, 2*step, ... up to the last one, then forces the final index to be exactly total_frames - 1 (so the last frame is always pinned, even if the division isn't clean).
  • Single image? You get "0" - one keyframe at the start, which is the plain image-to-video case.

The output is a STRING like 0, 15, 30, 45 - which is the format the LTX-2 conditioning pipeline expects for its keyframe index list. Feed the same images and the total frame count into it, and the indexes stay in sync with your actual frames automatically.

The inputs that matter

  • image - your keyframe images, as a batch (multiple frames wired in). The number of images determines how many keyframes get generated.
  • total_frames - the full length of the video you're generating, in frames.

One output: Indexes, a comma-separated STRING.

Installing it

Part of ComfyUI-Przewodo-Utils. ComfyUI Manager → search the pack, or:

cd ComfyUI/custom_nodes
git clone https://github.com/przewodo/ComfyUI-Przewodo-Utils.git

Restart. It's math plus a string join - no extra dependencies.

Where people get tripped up

The output is a string, not a list of ints. If the node you're wiring into expects a different shape (a list, or indexes in some other notation), you'll need to adapt it - this node produces exactly one format.

Also worth knowing: even spacing is a simplification. Real keyframe work often wants irregular placement - a keyframe at frame 10, another at 40, for deliberate pacing. This node can't express that; it's the "evenly spread" tool. For creative pacing, LTX Director and similar timeline tools exist precisely because hand-placing keyframes is where the interesting control lives. Use this node when you want predictable, even coverage and don't want to recompute indexes every time you tweak the length.

CategoryPrzewodoUtils

Inputs (2)

NameTypeDefaultDescription
imageIMAGEInput images to calculate the indexes.
total_framesINTTotal number of frames in the video. This is used to calculate the key frame indexes based on the total frames and the number of images.

Outputs (1)

NameTypeDescription
IndexesSTRING