# Audio codec sources and licenses

FileKit uses Mediabunny for local demuxing, PCM, and container writing. WebCodecs handles compressed audio on browsers with compatible configurations. The worker loads software codecs on first use. MP3 encoding uses LAME to preserve the output duration and bitrate mode across browsers. The FFmpeg decoder build exposes decoding for AAC, FLAC, MP3, Opus and Vorbis. The FFmpeg encoder build exposes AAC encoding. Both builds use the LGPL 2.1 or later configuration.

| Distributed component | License and corresponding source |
| --- | --- |
| Mediabunny 1.66.5 and its AAC and FLAC encoder extensions | [MPL-2.0](Mediabunny-MPL-2.0.txt). Copyright Vanilagy and contributors. [Exact source](https://github.com/Vanilagy/mediabunny/tree/52ca0157194bad6ae3f2a4238cf7cffaa7b8449a). |
| FFmpeg decoder and AAC encoder | [LGPL-2.1-or-later](FFmpeg-LGPL-2.1.txt). FFmpeg commit `60a2818f76dcd1fee3155b1791304af104a0fc1b`. [Source archive](https://codeload.github.com/FFmpeg/FFmpeg/tar.gz/60a2818f76dcd1fee3155b1791304af104a0fc1b), [AAC encoder build recipe](https://github.com/Vanilagy/mediabunny/tree/52ca0157194bad6ae3f2a4238cf7cffaa7b8449a/packages/aac-encoder#building-and-development). |
| libFLAC in the FLAC encoder | [BSD-3-Clause](libFLAC-BSD-3-Clause.txt). Copyright Xiph.Org Foundation and contributors. The build enables libFLAC 1.5.0-27 and disables programs, examples and Ogg. [Exact source](https://github.com/xiph/flac/tree/3f1ecff843dd1b8c07fbb5f59425a4ec71fe4f6c), [build recipe](https://github.com/Vanilagy/mediabunny/tree/52ca0157194bad6ae3f2a4238cf7cffaa7b8449a/packages/flac-encoder#building-and-development). |
| audiojs MP3 encoder 2.0.1 | [MIT](audiojs-MIT.txt). Copyright Dmitry Iv. [Exact source and build files](https://github.com/audiojs/encode/tree/8d914d0a76e5266b6a2591c11ea43aa0aeec1189/packages/encode-mp3). |
| wasm-media-encoders 0.7.0 MP3 wrapper | [MIT](WasmMediaEncoders-MIT.txt). Copyright arseneyr. The MP3 wrapper includes [SWC helpers 0.5.23](SWC-helpers-Apache-2.0.txt) under Apache-2.0. [Exact source and build files](https://github.com/arseneyr/wasm-media-encoders/tree/4a45333baadbab312d1cc0911151dfad23157c51). |
| LAME in the MP3 encoder | [LGPL-2.0-or-later](LAME-LGPL-2.0.txt). MP3 encoding by the LAME project. The WASM uses libmp3lame, built with the frontend, decoder, GTK and analyzer hooks disabled. [Attribution](LAME-attribution.txt), [LAME](https://lame.sourceforge.io/), [exact source used by wasm-media-encoders](https://github.com/arseneyr/lame/tree/98db548e8e851defbba3184125ce10725355c332). |
| libopus-wasm 0.4.1 | [MIT](libopus-wasm-MIT.txt). Copyright OpenClaw contributors. [Exact source and build files](https://github.com/openclaw/libopus-wasm/tree/cda66b7bf9b964ba56cf3491e85b3daf51bbb2d9). |
| libopus 1.6.1 in the Opus encoder | [BSD-3-Clause](libopus-BSD-3-Clause.txt). Copyright Xiph.Org Foundation, Skype Limited and contributors. [Source archive](https://downloads.xiph.org/releases/opus/opus-1.6.1.tar.gz). |
| Emscripten runtime and musl | [MIT or UIUC](Emscripten-license.txt) for Emscripten and [MIT and additional notices](Emscripten-musl-MIT.txt) for musl. [Emscripten 4.0.21](https://github.com/emscripten-core/emscripten/tree/4.0.21), [Emscripten 6.0.9](https://github.com/emscripten-core/emscripten/tree/6.0.9). |

## Rebuilding or replacing the codec binaries

The FFmpeg source archive SHA-256 is `50cac4cd224ec15e613b2180e654466a2ee25f86dde77c88228b80cda69f7351`. Activate Emscripten 4.0.21, extract the pinned source, and run `bash vendor/audio/rebuild-decoder.sh /path/to/FFmpeg` from the FileKit checkout. The script compiles and links `vendor/audio/decoder.c` against libavcodec, libswresample and libavutil with the exact shipped configuration. It writes the replacement module to `vendor/audio/decoder.mjs`. The shipped module SHA-256 is `4be613a33af9bfd277bedc4b413197fa1724b0e5dbf09e5bab0130dfacf5ff3e`.

To replace the AAC encoder, follow the linked Mediabunny build recipe and substitute the rebuilt extension before running `npm run build`. To replace LAME, build the pinned wasm-media-encoders MP3 target with your desired libmp3lame source, rebuild the pinned audiojs MP3 package, and substitute the rebuilt package. Apply the FileKit MP3 loader change to instantiate the embedded bytes in memory. The SHA-256 of the published MP3 WASM is `85e81719250b9a667b1258143f689dda70e3e57a7e7c29ab0b4cef65c8f6eb9a`. Run `npm run build` to bundle the replacement into the static site.
