Build from source¶
You don't need to build — every release ships both variants. But the whole pipeline is MIT and reproducible, so building it yourself is easy.
Prerequisites¶
- Docker (the build runs in a
wasi-sdkimage; nothing is installed on your host). - ~2 GB of disk and a few minutes.
Build a variant¶
The module lands at dist/ffmpeg-wasi-<variant>.wasm. To build a different upstream FFmpeg,
add --build-arg FFMPEG_VERSION=n8.1.2 (any FFmpeg release tag).
With just:
Run it¶
The repo bundles a tiny wazero harness that loads the module and runs it (it provides the
env setjmp/longjmp imports and the WebAssembly feature set the build needs):
You'll see the engine's capability report — the FFmpeg version and the available codecs/muxers/filters — confirming it links and runs:
ffmpeg-wasi engine
ffmpeg: n8.1.2
libavcodec 4070502 libavformat 4066406 libavfilter 724582
encoders:
libx264 yes # gpl variant only (no on lgpl)
aac yes
...
decoders:
h264 yes
...
What the build does¶
Three small scripts under build/, orchestrated by build/Dockerfile:
libav.sh— clones FFmpeg, configures it single-threaded forwasm32-wasi(libraries only), andmakes thelibav*archives.driver.sh— links the engine (src/driver.c) + the wasi compat shims against those archives into one.wasmcommand module.toolchain.sh— the shared wasi-sdk/clang cross-compile environment.
See The build for what makes it work (single-threaded config, setjmp/longjmp lowering, the POSIX/WASI compat shims).