Audio Extension Math (timeline sync)
The calculator that keeps audio and video in sync
- audio
- cursor_frames_out
- segment_start_frames
- segment_end_frames
- effective_unique_frames
- trim_frames
- segment_start_s
- segment_end_s
- remaining_frames_after
- is_last_segment
- report
The frame-accounting node behind LTX-2 audio-video extension
Multi-pass LTX-2 extension is a game of bookkeeping. Every pass generates raw frames, but only a fraction are new frames - the rest are overlap borrowed from the pass before. If your audio is sliced by raw frames while your video is stitched by unique frames, the sync drifts a little every segment, and by segment 20 your dialogue is half a second late. This node is the accountant that prevents that. It takes the pass's frame numbers and the timeline cursor, and computes exactly where the current segment sits in the stitched timeline - in frames and in seconds - plus how much audio to trim.
The inputs
audio,fps(default 25) - the timeline it's accounting against.segment_index- the zero-based pass number.generated_frames- raw frames the current pass produced.extension_frames- the unique frames actually added to the timeline.use_cursor_input(default on) - if true, trustcursor_frames_inas the canonical stitched-timeline cursor rather than recomputing it from scratch. This is the "stateless or stateful?" switch: with the cursor wired from the previous pass'scursor_frames_out, the math chains correctly across the whole loop.
Optional: first_pass_unique_frames (0 means use generated_frames for pass 0 - handy when pass 0 behaves differently because there's no overlap yet), and cursor_frames_in (the cumulative cursor before this pass).
The outputs - the whole point
cursor_frames_out- the cumulative cursor after this pass. Wire this into the next pass'scursor_frames_in. This single feedback loop is what keeps long runs honest.segment_start_frames/segment_end_frames- where the unique region lands in the timeline.effective_unique_frames- the true new-frame count, which is what the audio should actually cover.trim_frames- how many raw frames to cut (the overlap you don't re-lay).segment_start_s/segment_end_s- the same bounds in seconds, for audio slicing.remaining_frames_afterandis_last_segment- whether there's more timeline after this pass;is_last_segmentlets the graph switch behavior on the final pass (no overlap needed, full-length audio).report- a plaintext summary of the arithmetic.
How to use it
Pair it with IAMCCS_AudioExtender, which consumes its outputs (segment_start_frames, effective_unique_frames, timeline_cursor_frames) to slice audio - the tooltips cross-reference each other, and they're clearly designed as a set. Feed the sampler's pass frame counts in, thread cursor_frames_out → cursor_frames_in around the loop, and the audio side stays locked to the video side without you doing the math by hand.
It ships in IAMCCS-nodes (Manager: "IAMCCS", or clone IAMCCS/IAMCCS-nodes into custom_nodes, restart). No dependencies beyond standard AUDIO objects. The classic mistake is leaving use_cursor_input off and letting every pass recompute from zero - that works for a single pass but quietly breaks continuity across a loop. Keep the cursor chain connected and read the report if the sync ever looks off; the answer to "which number is wrong" is usually printed right there.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| audio | AUDIO | — | |
| fps | FLOAT | 25.000.001–240 | Timeline fps used by the stitched video. |
| segment_index | INT | 00–100000 | Zero-based generation pass index. |
| generated_frames | INT | 2491–100000 | Raw frames produced by the current pass. |
| extension_frames | INT | 2491–100000 | Unique frames actually added to the stitched timeline. |
| use_cursor_input | BOOLEAN | true | If true, trust cursor_frames_in as the canonical stitched timeline cursor. |
| first_pass_unique_framesopt | INT | 00–100000 | Optional explicit unique-frame count for pass 0. 0 means use generated_frames. |
| cursor_frames_inopt | INT | 00–10000000 | Cumulative unique-frame cursor before this pass. |
Outputs (10)
| Name | Type | Description |
|---|---|---|
| cursor_frames_out | INT | — |
| segment_start_frames | INT | — |
| segment_end_frames | INT | — |
| effective_unique_frames | INT | — |
| trim_frames | INT | — |
| segment_start_s | FLOAT | — |
| segment_end_s | FLOAT | — |
| remaining_frames_after | INT | — |
| is_last_segment | INT | — |
| report | STRING | — |