WebCodecs vs FFmpeg.wasm
Updated 2026-11-24
For years the only way to edit video inside a web page was to compile FFmpeg to WebAssembly. It works with almost any format, which is why most “online, no upload” video tools are built on it. But it has three structural limits:
- Software encoding. x264, libvpx and friends run on the CPU, inside WebAssembly, without the hardware video engine your device already has.
- Threads are awkward. Multi-threading needs
SharedArrayBuffer, which needs special cross-origin headers, and in our tests the multi-threaded build wasn’t faster than the single-threaded one. - Memory. The whole input is usually copied into WebAssembly memory, which caps practical file sizes.
What WebCodecs changes
WebCodecs is a browser API that exposes the platform’s video and audio encoders and decoders, the same hardware blocks your phone uses to record 4K. Combined with a demuxer/muxer like Mediabunny to read and write MP4, WebM and MOV, a web page can decode, transform and re-encode video at hardware speed, streaming the file from disk instead of loading it into memory.
Measured, not claimed
We run both engines on the same generated test files, in the same browser, on the same machine, and publish the numbers on our benchmarks page. On an Apple M4 in Chrome, WebCodecs was faster on every job we tested, from about 1.3× (MP3 extraction, where there’s no hardware MP3 encoder and the gain comes only from decoding) to over 10× (frame-accurate trims), with a median around 4×.
Where FFmpeg.wasm still wins
- Old or unusual formats. WebCodecs can’t read AVI, FLV or WMV containers or codecs like MPEG-4 Part 2. We keep FFmpeg.wasm as a lazy-loaded fallback for those, and the tools tell you when it ran.
- Exotic filters. FFmpeg has hundreds; anything beyond crop, scale, trim and overlays still needs it.
- Bit-exact quality control. Slow software presets can squeeze slightly better quality per bit than hardware encoders tuned for speed.
The practical answer is both: hardware by default, FFmpeg when it’s genuinely needed.