gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.94k stars 326 forks source link

Support for muxing AV1 video #282

Closed AshleyScirra closed 2 years ago

AshleyScirra commented 2 years ago

Thanks for your work on MP4box.js!

I'm using WebCodecs and looking to mux the supported video codecs to MP4. I got some sample code working with AVC. However if I swap out AVC for the new AV1 format, and remove the AVC-specific parts, the resulting MP4 file is not playable.

Here's a minimal repro configured to mux AV1 as supported by Chrome: mp4-av1-test.zip

The following changes have been made to swap AVC for AV1:

If you reverse those changes (just change what is commented out) it can produce a playable MP4 file with the AVC codec. Presumably further changes are necessary for AV1. I'm not sure what those are - it would be great if any necessary changes could be made to support it, or otherwise to document it if already supported for use with WebCodecs,

AshleyScirra commented 2 years ago

My bad! Add type: "av01" to the addTrack options and it works fine. Otherwise it defaults to AVC. Hopefully this helps some future web searcher!