Skip to content
transom.design

Video Scribe - 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
StageWhat it buildsCached?
emsdk-baseEmscripten SDK base image + apt packagesYes
x264-builderlibx264 (H.264 encoder)Yes
libvpx-builderlibvpx (VP8/VP9)Yes
opus-builderlibopus (audio)Yes
aom-builderlibaom 3.4.0 (AV1)Yes
dav1d-builderlibdav1d 1.4.3 (fast AV1 decode)Yes
ffmpeg-baseFFmpeg n5.1.4 source + merged libsYes
ffmpeg-builderFFmpeg configured + compiledBust to re-run
ffmpeg-wasm-builderEmscripten link → .js + .wasm + .worker.jsBust 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.