Mediabunny should write an edit list
Author: JonnyBurgerCreated Jul 27, 2026Updated Jul 30, 2026
- Create a MP4+AAC with Mediabunny
- Write 1 second of video and 1 second of audio
- Use the output as input
.computeDuration()- Observe that the duration is 1.066667s.
Gist: https://gist.github.com/JonnyBurger/f5766bca2a7544eb8640617302347cb4
This is due to AAC priming.
I see in most MP4 files that there is an edts atom - probably exactly because of that.
Compare to FFmpeg:
ffmpeg -f lavfi -i "anullsrc=channel_layout=stereo:sample_rate=48000" -t 1 -c:a aac -b:a 128k -y ffmpeg-silence.mp4Inputting that into Mediabunny works as expected - 1sec duration. The first timestamp is -0.021333s.
I think Mediabunny should adopt this as well and write an edit list.
- Could it be that this leads to audio playback being out of sync? Given that we don't negative timestamp the first packet? (Didn't test)
- QuickTime bug: Seeking to the end of a video encoded with Mediabunny makes the video turn black.
For internal reference: https://github.com/remotion-dev/remotion/issues/7099
Source: Vanilagy/mediabunny