libav WebAssembly port.
libav (incl. libavcodec, libavformat, …) is the library behind FFmpeg to record, convert and stream audio and video. This repository aims to port libav to WebAssembly to allow users edit video and audio directly inside the browser.
ffmpeg.wasm ports FFmpeg to WebAssembly using a more coarse-grained approach (you can imagine ffmpeg.wasm as an extremely large function, once it starts to run, there isn't much you can control.), it works but also suffers from the isolation of C and JavaScript world which makes it hard to develop and improve.
The ultimate goal of libav.wasm is to enable a ffmpeg.wasm with better developer experience (DX) and potentially be the foundation to fix issues like performance and more.
We use docker to achieve a (hopefully) cached and reproducible build, so it is required to install docker 19.03 or above before you run any build script.
npx lerna run bootstrap
npx lerna run build
# build `dev` version
$ make
# build `prod` version (slower, optimized with -O3 -msimd128)
$ make prd
If nothing went wrong, you should find libav assets in dist/.
A few examples can be found in apps/node-ts, feel free to try and see how it works in action.
As these examples use video files in testdata/, you need to do a
git submodule update --init
first
npm run metadata
npm run transcode
libav.wasm is built using tools/libraries with version:
Name | Version |
---|---|
emsdk | 3.1.18 |
FFmpeg | n5.1 |
x264 | 0.164.x (num of cpu fixed to 4) |