Source Range From Segment Plan
Slice the exact source frames each LTX segment needs, overlap included
- range_start_index
- range_end_index
- range_count
- report
Once your LTX-2 extension plan exists, someone has to answer the question "which frames of the source footage do I feed this segment?" That's IAMCCS_SourceRangeFromSegmentPlan. Given a segment's plan numbers, it computes the inclusive frame range into the source that the segment should consume - including the overlap backtrack so continuation segments re-see the tail of the previous chunk.
It's a small arithmetic node that sits between the planner family and the frame-slicing / start-image loading steps in the extension workflow. If you're doing source-video-to-video or frame-by-frame source alignment, this is the node that turns "segment 3 starts at frame 480" into "load frames 471 through 720" without you doing the off-by-overlap math by hand.
How it works
The key subtlety is the overlap backtrack. A continuation segment generates current_segment_raw_frames total, but only current_segment_unique_frames are genuinely new - the difference is overlap carried from the previous segment. So the range has to start earlier than the segment's unique start to include that overlap: the node computes overlap_delta = raw - unique, backtracks overlap_delta - 1 frames from current_segment_start_frames (and backtracks nothing for segment 0, since the first segment has no overlap), then returns range_start_index through range_end_index covering range_count frames. Every number is clamped to be safe, and report shows the full breakdown.
Inputs and outputs
Inputs (all straight from a planner's current-segment outputs, or the derivation node):
- segment_index - which segment you're on (drives the backtrack rule).
- current_segment_raw_frames - frames this segment will actually generate.
- current_segment_unique_frames - new content frames.
- current_segment_start_frames - where the segment begins in the timeline.
Outputs:
range_start_index- first source frame to loadrange_end_index- last (exclusive)range_count- how many frames that isreport- the math, spelled out
Installing
ComfyUI Manager → search "IAMCCS", or
cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git
Restart. No models, no pip deps - pure integer arithmetic on the plan.
Gotchas
The classic error is feeding it planner outputs from a different plan than the one driving the sampler - the overlap backtrack silently shifts by a frame or two and you get a barely-perceptible jump at every segment boundary that's brutal to diagnose. Also note range_end_index is exclusive and range_count is end - start: when you're looping over the range to slice frames, use range(start, end), not range(start, start + raw). And segment 0's backtrack is zero by design - don't "fix" it by hand or you'll load one frame early.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| segment_index | INT | 00–100000 | — |
| current_segment_raw_frames | INT | 2411–1000000 | — |
| current_segment_unique_frames | INT | 2401–1000000 | — |
| current_segment_start_frames | INT | 00–10000000 | — |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| range_start_index | INT | — |
| range_end_index | INT | — |
| range_count | INT | — |
| report | STRING | — |