One Offset Is Not Enough
Independent audio and video clocks can begin misaligned and continue separating, so a single timeline shift fixes the opening while the ending still drifts.
avsyncdoctor detects flash and click events, fits offset and clock ratio, applies FFmpeg trim and tempo correction, and remeasures the output.
The Demo
Five anchors contain a known 120 ms offset and 5,000 ppm clock drift. The real MP4 integration test detects the mismatch, repairs it, and requires the resulting maximum skew to remain below 40 ms.
The event-based path suits claps, flashes, impacts, and test slates. Continuous speech and semantic mismatch require content-aware audio-visual features.
Research Basis
AV-SyncBench separates temporal alignment from semantic correspondence when evaluating audio-video synchronization.
Read the AV-SyncBench.
Bad Fixtures Broke The Fit, Not Just The Numbers
A least-squares fit is only as safe as its edge cases. The offset/drift estimator divided by the variance of the video timestamps and, separately, by the fitted slope, with no guard on either denominator ever landing on zero.
Verified directly: a fixture with identical video event timestamps, and a separate fixture with perfectly constant audio event timestamps, each crashed the estimator with an unhandled division-by-zero — and that exception type wasn't one the JSON API's error handling caught, so either fixture posted to the live endpoint dropped the connection with no response at all.
Fixed by rejecting both degenerate cases with a clear error before the division runs. The published demo numbers — 120 ms offset, 5,000 ppm drift, failing before correction and passing after — are unchanged.