# WebCodecs (Mediabunny) vs ffmpeg.wasm: benchmark harness Scripts and raw results behind the article https://pixohub.com/blog/webcodecs-vs-ffmpeg-wasm (tested 14 November 2026). Repository: https://github.com/MonsterInstitute/webcodecs-vs-ffmpeg-wasm Job: transcode 20 s 1080p clips to 1280x720 H.264 at a 2 Mbps target, AAC copied, MP4, in headless Chrome. Engines: Mediabunny 1.62.1 on WebCodecs (hardware and software), ffmpeg.wasm 0.12.15 with @ffmpeg/core 0.12.10 (single-threaded) and @ffmpeg/core-mt 0.12.10 (4 threads), plus native ffmpeg references. ## Files | File | What it does | |---|---| | `clips.txt`, `prep.sh` | Downloads five CC BY-SA 4.0 videos from Wikimedia Commons and makes `clips/*.mp4` | | `src/bench.js` | Browser side: Mediabunny, ffmpeg.wasm ST/MT, big-file tests (`writeFile` and WORKERFS) | | `serve.mjs` | Static server; `ISOLATE=1` adds COOP/COEP (needed for ffmpeg.wasm MT) | | `run.mjs` | Drives headless Chrome, a fresh page per job, appends JSON lines | | `jobs.json`, `jobs-ladder.json` | The job lists we ran | | `native.sh` | Native ffmpeg references (libx264 veryfast, h264_videotoolbox; macOS) | | `vmaf.py` | VMAF of each output vs its source (ffmpeg with libvmaf) | | `src/wtest.js`, `wrun.mjs`, `stretch3.sh` | Plain-WebCodecs test of the canvas-width stretch (raw .h264 + PSNR search) | | `coep/test.mjs` | Which ad resources load under COEP require-corp / credentialless | | `results.json` | Every number in the article | ## Run Needs Node 20+, Chrome, ffmpeg with libx264 and libvmaf, Python 3. ``` npm install && npm run build ./prep.sh ISOLATE=1 PORT=8791 node serve.mjs & node run.mjs jobs.json results.jsonl 8791 bash native.sh > native.jsonl python3 vmaf.py out clips > vmaf.json ``` Notes: set `-threads` explicitly for ffmpeg.wasm MT (no flag hung for us; 6 errored; 8 and 12 hung on an 8-core M2). Hardware encoders differ by machine, so expect different quality numbers on Windows, Linux or Android. Test clips (CC BY-SA 4.0, Wikimedia Commons): "Strike For Climate Brussels 1" by Jan Ainali; "Snail traversing a leaf - 20190801" by Sikander Iqbal; "Akanksha DEF India - VisibleWikiWomen at APC gathering 2024" by Mariana Fossatti; "Incubator app walkthrough (English)" by HakanIST; "Lëtzebuerger Volleksdanz 30-09-2023" by GilPe. The scripts are MIT licensed.