Nodes/IAMCCS-nodes/Segment Planner (song -> LTX frames)
ComfyUI Node

Segment Planner (song -> LTX frames)

Turn a song into an LTX-2 segment plan without doing the frame math yourself

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
Segment Planner (song -> LTX frames)
    • 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
    song_duration_s180.00
    fps24.00
    segment_duration_s10.00
    planning_modemanual_segment_seconds
    segment_preset15sec
    overlap_frames9
    ltx_round_modeup
    segment_index0

    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_seconds uses your segment_duration_s; explicit_preset_seconds overrides 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.

    CategoryIAMCCS/LTX-2

    Inputs (8)

    NameTypeDefaultDescription
    song_duration_sFLOAT180.000.01–36000
    fpsFLOAT24.000.001–240
    segment_duration_sFLOAT10.000.01–3600
    planning_modeCOMBOmanual_segment_seconds2 options: manual_segment_seconds, explicit_preset_seconds
    segment_presetCOMBO15sec6 options: 5sec, 10sec, 15sec, 20sec, videoclip, monologue
    overlap_framesINT90–4096
    ltx_round_modeCOMBOup3 options: up, nearest, down
    segment_indexINT00–100000

    Outputs (23)

    NameTypeDescription
    total_framesINT
    unique_segment_framesINT
    first_segment_raw_framesINT
    continuation_raw_framesINT
    estimated_segmentsINT
    continuation_loopsINT
    last_segment_unique_framesINT
    reportSTRING
    segment_index_outINT
    current_segment_raw_framesINT
    current_segment_unique_framesINT
    current_segment_start_framesINT
    current_segment_end_framesINT
    current_remaining_frames_afterINT
    current_segment_start_sFLOAT
    current_segment_end_sFLOAT
    current_segment_reportSTRING
    fps_outFLOAT
    recommended_overlap_framesINT
    recommended_audio_left_context_sFLOAT
    recommended_extension_presetSTRING
    effective_planning_modeSTRING
    planning_profile_reportSTRING