Mediabunny fixes audio-video sync drift in WebCodecs processing

Mediabunny author Vanilagy has detailed Project Sync, an effort to maintain audio-video synchronization down to individual audio samples. The changes have been available since version 1.63.0 and address both WebCodecs encoder delay and the handling of timestamps in media containers.
In an initial experiment, transcoding a Big Buck Bunny clip 64 times left the audio more than two seconds behind the video and extended the file from five seconds to almost nine. A separate test of Apple’s AAC encoder on a Mac measured a delay of 2,112 samples, equivalent to 44 milliseconds at 48 kHz. Repeated processing accumulated that delay.
Vanilagy explains that encoders add initial data needed to reconstruct the signal correctly, but WebCodecs provides no way to report the resulting delay. Mediabunny now measures it on each system using a test impulse, then shifts output audio packet timestamps accordingly. The author says the measurement produced correct results across the browsers and operating systems tested and also works with Opus.
The library also gained support for the required timing adjustments in container formats. Its HLS muxer now defaults to an internal timestamp shift of 10 seconds. In the author’s final test, audio and video remained synchronized after the same clip was transcoded 256 times.
Original source: mediabunny.dev ↗
Comments on source platforms
Rank is the maximum of the latest discussion counts. These are source metrics.
Hacker News
- Discussion ↗: 2
Measured: 7 Nov 2026, 19:34 UTC