Skip to content

About

Audio-only fork of ffmpeg.wasm: FFmpeg 6.1.6 in 2 MB, the core behind PrivAudio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ffmpeg.wasm, audio only

This is an audio-only fork of ffmpeg.wasm, the build of FFmpeg behind PrivAudio, a converter that turns audio files into MP3, M4A, OGG or WAV inside the browser, without uploading them anywhere.

The standard ffmpeg.wasm core can do almost anything FFmpeg can, so the browser has to download all of it before the first conversion. PrivAudio only ever reads audio, so I rebuilt the core with everything else switched off.

Single-threaded core Download (gzip) On disk
@ffmpeg/core 0.12.10 10.3 MB 32.2 MB
This build 2.0 MB 4.7 MB

That's 80% less to download before the first file converts.

What changed from upstream

  • FFmpeg 6.1.6, with only the audio parts it needs: no video decoders, encoders or filters.
  • It reads audio from music files (FLAC, ALAC, APE, WavPack, MP3, AAC, Opus, Vorbis, WMA, AC-3, DTS, PCM), from video files (MP4, MKV, WebM, AVI, FLV, MPEG-PS and MPEG-TS) and from phone and older formats (AMR, GSM, ADPCM, Nellymoser).
  • It writes MP3 (LAME), AAC, Vorbis, Opus, FLAC, ALAC, WavPack and PCM. PrivAudio uses the first three and WAV.
  • The multi-threaded core starts with 128 MB of memory instead of 1 GB.
  • The Docker images are pinned by digest, and FFmpeg, LAME, Ogg, Opus and Vorbis by commit. Only the build tools from apt (autoconf, automake, libtool, pkg-config, ragel) follow the image's package index.

The JavaScript packages (@ffmpeg/ffmpeg, @ffmpeg/util) are unchanged, so the API is upstream's. See its documentation.

Build

You need Docker with Buildx.

make prd                         # single-threaded core -> packages/core/dist/{umd,esm}
node scripts/verify-core.cjs     # fails if a format PrivAudio relies on is missing

make prd-mt still builds the multi-threaded core, but PrivAudio doesn't use it and I don't test it.

License

  • The JavaScript wrapper is MIT, from upstream. See LICENSE.
  • The compiled core is FFmpeg, built without --enable-gpl, so it is LGPL-2.1-or-later. It links LAME (LGPL) and Ogg, Vorbis and Opus (BSD).
  • Each tag in this repository is the complete source for a core PrivAudio ships.

Credit

Built on ffmpeg.wasm by Jerome Wu and its contributors, forked at f876f90. All the hard work of getting FFmpeg into WebAssembly is theirs.

About

Audio-only fork of ffmpeg.wasm: FFmpeg 6.1.6 in 2 MB, the core behind PrivAudio.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages