Segment Planner (song -> LTX frames)
Turn a song into an LTX-2 segment plan without doing the frame math yourself
- total_frames
- unique_segment_frames
- first_segment_raw_frames
- continuation_raw_frames
- estimated_segments
- continuation_loops
- last_segment_unique_frames
- report
- segment_index_out
- current_segment_raw_frames
- current_segment_unique_frames
- current_segment_start_frames
- current_segment_end_frames
- current_remaining_frames_after
- current_segment_start_s
- current_segment_end_s
- current_segment_report
- fps_out
- recommended_overlap_frames
- recommended_audio_left_context_s
- recommended_extension_preset
- effective_planning_mode
- planning_profile_report
If you've ever tried to make a full music video with LTX-2, you know the pain this node exists to kill: LTX doesn't do long clips in one pass, so you generate segment after segment and stitch them, which means someone has to compute how many frames the song is, how many fit per segment, how many overlap frames to carry forward, and what LTX's infuriating frame-count constraints do to every number. IAMCCS_SegmentPlanner is that someone. Feed it a song duration and it hands you the whole segmentation plan, plus the exact numbers for whatever segment you're currently on.
It's the brain of the pack's LTX-2 extension workflow. You'll typically wire its outputs into the extension/sampler nodes (or the pack's own StartImagesToVideoLatent / StartDirToVideoLatent injection nodes), and let a loop drive segment_index.
How it works
The planner is pure math, no model calls. It converts song duration × fps into a total frame count, splits it into estimated_segments, and - the part that actually earns its keep - rounds every segment length to LTX's valid frame pattern. LTX latents want 8n+1 frames, and your raw segment length almost never lands on one. ltx_round_mode (up, nearest, or down) decides which direction to round, and the node distinguishes the first_segment_raw_frames (no overlap needed) from continuation_raw_frames (unique frames + overlap, rounded again).
Because this gets run once per loop iteration, it also computes the current segment's numbers from segment_index: raw frames, unique frames, start/end frames, start/end in seconds, and what's left after.
The inputs that actually matter
- song_duration_s and fps - the whole plan derives from these two.
- segment_duration_s - how long each chunk should be.
- planning_mode -
manual_segment_secondsuses yoursegment_duration_s;explicit_preset_secondsoverrides it with the preset's length. - segment_preset -
5sec/10sec/15sec/20sec/videoclip/monologue. Picks sane defaults and feeds the recommendation outputs (recommended_overlap_frames,recommended_audio_left_context_s,recommended_extension_preset). - overlap_frames - how many frames of the previous segment get carried into the next (default 9, a good starting point).
- segment_index - set this to the current loop iteration.
The headline outputs are total_frames, first_segment_raw_frames, continuation_raw_frames, estimated_segments, continuation_loops, and the current-segment set: current_segment_raw_frames, current_segment_start_frames, current_segment_end_frames, current_segment_start_s/_end_s. There's also a readable report string for each segment and a planning_profile_report that shows which preset it actually applied.
Installing
The pack is on ComfyUI Manager - search "IAMCCS". Or grab it manually:
cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git
Restart ComfyUI. The README calls for ComfyUI ≥ 0.3.0, Python ≥ 3.12, and Torch ≥ 2.8 (CUDA 12.6/12.8). The planner itself downloads nothing and has no pip dependencies - but the workflow it feeds needs an LTX-2 model, video VAE, and audio VAE, and that's where your disk and VRAM go.
Gotchas
The two classic traps: forgetting that LTX frame counts aren't arbitrary (trust ltx_round_mode = up until you have a reason not to), and ignoring the difference between unique_segment_frames and continuation_raw_frames - use the raw value when you're actually sampling a continuation or the last frames won't match the next segment's start. Also note the node clamps an out-of-range segment_index rather than erroring, so your loop won't die at the last segment; it just replays the final one.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| song_duration_s | FLOAT | 180.000.01–36000 | — |
| fps | FLOAT | 24.000.001–240 | — |
| segment_duration_s | FLOAT | 10.000.01–3600 | — |
| planning_mode | COMBO | manual_segment_seconds | 2 options: manual_segment_seconds, explicit_preset_seconds |
| segment_preset | COMBO | 15sec | 6 options: 5sec, 10sec, 15sec, 20sec, videoclip, monologue |
| overlap_frames | INT | 90–4096 | — |
| ltx_round_mode | COMBO | up | 3 options: up, nearest, down |
| segment_index | INT | 00–100000 | — |
Outputs (23)
| Name | Type | Description |
|---|---|---|
| total_frames | INT | — |
| unique_segment_frames | INT | — |
| first_segment_raw_frames | INT | — |
| continuation_raw_frames | INT | — |
| estimated_segments | INT | — |
| continuation_loops | INT | — |
| last_segment_unique_frames | INT | — |
| report | STRING | — |
| segment_index_out | INT | — |
| current_segment_raw_frames | INT | — |
| current_segment_unique_frames | INT | — |
| current_segment_start_frames | INT | — |
| current_segment_end_frames | INT | — |
| current_remaining_frames_after | INT | — |
| current_segment_start_s | FLOAT | — |
| current_segment_end_s | FLOAT | — |
| current_segment_report | STRING | — |
| fps_out | FLOAT | — |
| recommended_overlap_frames | INT | — |
| recommended_audio_left_context_s | FLOAT | — |
| recommended_extension_preset | STRING | — |
| effective_planning_mode | STRING | — |
| planning_profile_report | STRING | — |