Skip to content

fix(concat): correct xfade offset calculation for variable transition durations - #7

Merged
leether merged 1 commit into
mainfrom
feat/fix-concat-offset
Jun 7, 2026
Merged

fix(concat): correct xfade offset calculation for variable transition durations#7
leether merged 1 commit into
mainfrom
feat/fix-concat-offset

Conversation

@leether

@leether leether commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Fixes ffmpeg filter_complex failure caused by offset regression when transition durations vary across clips.

… durations

Bug: offset = cum_duration - trans_duration * i
  This assumed all transitions have the same duration. When a later
  transition duration increased (e.g., 0.4 -> 0.5), trans_duration*i
  could grow faster than cum_duration, causing negative offset regression.

  Example from rsi_cn timeline:
    i=38 offset=520.58  (td=0.4)
    i=39 offset=519.66  (td=0.5) ← regression!

Fix: offset = cum_duration - sum(all_transition_durations[:i])
  Each transition's actual duration is now accumulated individually.

Verified: all 48 offsets are monotonically increasing after fix.

Closes: concat-engine-offset-regression
@leether
leether merged commit 609616b into main Jun 7, 2026
1 check passed
@leether
leether deleted the feat/fix-concat-offset branch June 7, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant