@mediabunny/ac3
Browsers have no support for AC-3 (Dolby Digital) or E-AC-3 (Dolby Digital Plus) in their WebCodecs implementations. This extension package provides both a decoder and encoder for use with Mediabunny, allowing you to decode and encode these codecs directly in the browser. It is implemented using Mediabunny's custom coder API and uses a fast, size-optimized WASM build of FFmpeg's AC-3 and E-AC-3 coders under the hood.
GitHub pageInstallation
This library peer-depends on Mediabunny. Install both using npm:
npm install mediabunny @mediabunny/ac3Alternatively, directly include them using a script tag:
<script src="mediabunny.js"></script>
<script src="mediabunny-ac3.js"></script>This will expose the global objects Mediabunny and MediabunnyAc3. Use mediabunny-ac3.d.ts to provide types for these globals. You can download the built distribution files from the releases page.
Usage
import { registerAc3Decoder, registerAc3Encoder } from '@mediabunny/ac3';
registerAc3Decoder();
registerAc3Encoder();That's it - Mediabunny now uses the registered AC-3/E-AC-3 decoder and encoder automatically.