WASM build
The compiled WASM is at src/web/assets/core/dist/ and tracked via Git LFS. Rebuild when updating ffmpeg, adding a codec, or changing build flags.
Prerequisites
Section titled “Prerequisites”- Docker with at least 16 GB allocated (28 GB recommended). In OrbStack: Settings → Resources → Memory.
- ~3 GB disk for Docker layer cache.
Run from the ffmpeg-build/ directory inside the plugin:
cd plugins/video-scribe/ffmpeg-build
docker buildx build \ --platform linux/amd64 \ --file Dockerfile.video-scribe \ --output "type=local,dest=dist" \ --target exportor \ --progress=plain \ . 2>&1 | tee build.logFirst run: 30–60 minutes. Subsequent runs: 15–20 minutes — codec stages are cached.
After a successful build
Section titled “After a successful build”cp ffmpeg-build/dist/dist/esm/ffmpeg-core.* src/web/assets/core/dist/npm run buildCommit the updated files. Craft picks them up on the next request.
Rebuilding only the ffmpeg stages
Section titled “Rebuilding only the ffmpeg stages”Use --no-cache-filter when changing ffmpeg flags without touching the codec libraries:
docker buildx build \ --platform linux/amd64 \ --file Dockerfile.video-scribe \ --output "type=local,dest=dist" \ --target exportor \ --no-cache-filter emsdk-base,ffmpeg-base,ffmpeg-builder,ffmpeg-wasm-builder \ --progress=plain \ . 2>&1 | tee build.logDockerfile stages
Section titled “Dockerfile stages”| Stage | What it builds | Cached? |
|---|---|---|
| emsdk-base | Emscripten SDK base image + apt packages | Yes |
| x264-builder | libx264 (H.264 encoder) | Yes |
| libvpx-builder | libvpx (VP8/VP9) | Yes |
| opus-builder | libopus (audio) | Yes |
| aom-builder | libaom 3.4.0 (AV1) | Yes |
| dav1d-builder | libdav1d 1.4.3 (fast AV1 decode) | Yes |
| ffmpeg-base | FFmpeg n5.1.4 source + merged libs | Yes |
| ffmpeg-builder | FFmpeg configured + compiled | Bust to re-run |
| ffmpeg-wasm-builder | Emscripten link → .js + .wasm + .worker.js | Bust to re-run |
Adding a codec library
Section titled “Adding a codec library”- Add a build script to
ffmpeg-build/build/<codec>.shfollowing the existing pattern. - Add a
FROM emsdk-base AS <codec>-builderstage inDockerfile.video-scribe. COPY --from=<codec>-builder $INSTALL_DIR $INSTALL_DIRinffmpeg-base.- Add
--enable-lib<codec>to theffmpeg-builderRUN step. - Add
-l<codec>toFFMPEG_LIBSinffmpeg-wasm-builder. - Rebuild.
Memory
Section titled “Memory”The build uses -j4 in build/ffmpeg-vs.sh to cap parallel compile jobs. Unlimited parallelism (-j) can push past 20 GB and trigger OOM kills. If you see SIGKILL in the build log, lower parallelism or increase Docker’s memory limit.