Mediabunny fixes WebCodecs' hidden audio delay to achieve sample-perfect AV sync
Project Sync: The journey to sample-perfect audio/video sync with WebCodecs
Mediabunny's creator discovered that WebCodecs audio encoders add an uncompensated priming delay—44 ms on macOS with AAC—that breaks AV sync after repeated transcodes. Since the WebCodecs spec and browsers ignore this, Mediabunny now empirically measures each encoder's delay using an impulse signal, shifts packet timestamps negative, and updates every muxer (ISOBMFF, Matroska, MPEG-TS, MP3) to handle negative timestamps correctly.
What's not correct is pretending that this signal starts at timestamp 0.