Skip to content
transom.design

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.

  • 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:

Terminal window
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.log

First run: 30–60 minutes. Subsequent runs: 15–20 minutes — codec stages are cached.

Terminal window
cp ffmpeg-build/dist/dist/esm/ffmpeg-core.* src/web/assets/core/dist/
npm run build

Commit the updated files. Craft picks them up on the next request.

Use --no-cache-filter when changing ffmpeg flags without touching the codec libraries:

Terminal window
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.log

| 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 |

  1. Add a build script to ffmpeg-build/build/<codec>.sh following the existing pattern.
  2. Add a FROM emsdk-base AS <codec>-builder stage in Dockerfile.video-scribe.
  3. COPY --from=<codec>-builder $INSTALL_DIR $INSTALL_DIR in ffmpeg-base.
  4. Add --enable-lib<codec> to the ffmpeg-builder RUN step.
  5. Add -l<codec> to FFMPEG_LIBS in ffmpeg-wasm-builder.
  6. Rebuild.

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.