Nodes/IAMCCS-nodes/LTX-2 Long Video Wrapper Prep ??
ComfyUI Node

LTX-2 Long Video Wrapper Prep ??

Hand each segment of a 3-minute video the exact frames it owns

By IAMCCS·Created 11 months ago·Updated 8 days ago· 113
LTX-2 Long Video Wrapper Prep ??
  • source_images
  • images
  • current_segment
  • total_segments
  • segment_report
  • plan_report
  • trim_head_frames
  • render_id
  • continuation_trim_head_frames
song_duration_s180.00
fps24.00
segment_duration_s10.00
segment_index0
render_id
bridge_nameltx2_detailer_bridge
use_bridge_anchorfalse
planning_modemanual_segment_seconds
content_profilevideoclip
overlap_frames9
ltx_round_modeup
head_k_frames1
head_modehard_lock
head_blend_strength1.00
min_frames25
min_frames_moderepeat_last
min_frames_ltx_fixup

IAMCCS_LTX2_LongVideoWrapperPrep is the planning node for long LTX-2 video: you tell it how long your song/clip is, your FPS, how long each generation segment should be, and which segment you're rendering right now - and it hands back the exact frame range that segment owns, with the head-anchor frames it needs for continuity, all pre-rounded to LTX-2's frame math. It's the "which frames are mine?" answer that keeps a multi-segment render from stitching together clips that don't line up.

Here's the problem it solves. LTX-2 can generate a respectable chunk natively, but a 3-minute music video is segments, and segments need four things to join cleanly: an overlap so the model has context, a head lock so segment N+1 starts exactly where segment N ended, frame counts rounded to the model's valid lengths, and a plan that's identical on every run so you can render segment 5 on Tuesday and it knows it's segment 5. If you've ever had a long-video wrapper produce a clip that comes back two frames short, or a seam where the model "invented" a new first frame, you've met the temporal-compression trap this node exists to defuse.

How it works

It divides song_duration_s by segment_duration_s to get total_segments and computes the range for segment_index. It then applies the LTX frame rules: LTX video VAEs compress time 8×, and valid lengths are 8n+1 - so ltx_round_mode (up/nearest/down) snaps frame counts to legal values, and min_frames (default 25) with min_frames_mode (repeat_last or error) protects tiny tail segments that would be too short to sample. The overlap_frames (default 9) is how much context bleeds between segments.

The continuity mechanism is the head_* family: head_k_frames (default 1) anchors the segment's opening frames to the previous segment's last frame via head_mode - hard_lock (hold the anchor exactly), linear_blend, or ramp - so the model can't drift a new opening frame into existence. head_blend_strength scales that. The outputs then tell the wrapper what to trim: trim_head_frames and continuation_trim_head_frames are the counts to cut so overlap/context frames never appear in the final cut.

planning_mode (manual_segment_seconds or auto_profile) and content_profile (videoclip/monologue) pick between explicit segment lengths and an auto profile tuned to content type. render_id and bridge_name (with use_bridge_anchor) let a detailer bridge keep identity across segments, which is how the pack keeps a character from drifting between takes.

Inputs and outputs

Inputs: source_images, song_duration_s, fps, segment_duration_s, segment_index, plus the optional planning/rounding/head options above. Outputs: images (the segment's frame range, with head anchor applied), current_segment, total_segments, segment_report, plan_report (the two JSON reports that tell you exactly what was computed - read them when a seam misbehaves), trim_head_frames, render_id, and continuation_trim_head_frames.

Installing it

Part of the IAMCCS-nodes pack. ComfyUI Manager → search IAMCCS, or:

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

Restart ComfyUI; it's under IAMCCS/LTX-2. No pip requirements, no model downloads - you feed it your frames and an LTX-2 setup you already run. README floor: ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8.

Where people get burned

  • Same segment_duration_s/fps/segment_index must be used on every segment run, or segments stop agreeing on the plan. This node is deterministic on purpose; changing a number mid-run corrupts the whole timeline, not one segment.
  • Forgetting the 8n+1 rule still applies downstream. The node rounds its inputs; the sampler/VAE path must respect the same lengths or you get the "two frames short" clip that no amount of overlap fixes.
  • min_frames_mode = error will fail your render on a short tail segment by design - switch to repeat_last unless you genuinely want a hard stop. That default-inverted footgun is the one people hit first.
CategoryIAMCCS/LTX-2

Inputs (18)

NameTypeDefaultDescription
source_imagesIMAGE
song_duration_sFLOAT180.000.01–36000
fpsFLOAT24.000.001–240
segment_duration_sFLOAT10.000.01–3600
segment_indexINT00–1000000
render_idoptSTRING
bridge_nameoptSTRINGltx2_detailer_bridge
use_bridge_anchoroptBOOLEANfalse
planning_modeoptCOMBOmanual_segment_seconds2 options: manual_segment_seconds, auto_profile
content_profileoptCOMBOvideoclip2 options: videoclip, monologue
overlap_framesoptINT90–4096
ltx_round_modeoptCOMBOup3 options: up, nearest, down
head_k_framesoptINT11–64
head_modeoptCOMBOhard_lock3 options: hard_lock, linear_blend, ramp
head_blend_strengthoptFLOAT1.000–1
min_framesoptINT251–1000000
min_frames_modeoptCOMBOrepeat_last2 options: repeat_last, error
min_frames_ltx_fixoptCOMBOup4 options: none, up, down, nearest

Outputs (8)

NameTypeDescription
imagesIMAGE
current_segmentINT
total_segmentsINT
segment_reportSTRING
plan_reportSTRING
trim_head_framesINT
render_idSTRING
continuation_trim_head_framesINT