# Rebuild FFmpeg WebAssembly core 0.12.10

The released browser engine is the single-thread ESM build of @ffmpeg/core 0.12.10. The npm archive and the deployed file identifiers are recorded in manifest.json. FFmpeg is n5.1.4 and the ffmpeg.wasm release commit is 71aa99d37c02a7b4c435275ca9ef50e612f6efa1 (tag v12.15). The accompanying @ffmpeg/ffmpeg 0.12.15 wrapper sources are in the same upstream release archive.

## Download and check the source

Save manifest.json, prepare-build.py, and every linked archive or part in this layout. The paths starting with sources/ are relative to the directory that contains manifest.json. Use Python 3.10 or later.

    python3 prepare-build.py --verify

The verifier checks each file's size and SHA-256 and checks the original archive hash across its ordered parts. The splits preserve the original HarfBuzz and Emscripten archives individually. To unpack either manually, concatenate its part01 and part02 in that order, then open the resulting .tar.gz with tar. Example on Linux or macOS:

    cat sources/harfbuzz-4a1d891c6317.tar.gz.part01 sources/harfbuzz-4a1d891c6317.tar.gz.part02 > harfbuzz-4a1d891c6317.tar.gz
    tar -xzf harfbuzz-4a1d891c6317.tar.gz

## Build the single-thread core

On a machine with Docker Buildx and Linux amd64 support, run the commands below from the download directory. The Python script creates a new ffmpeg-core-build directory.

    python3 prepare-build.py --build-context ffmpeg-core-build
    docker buildx build --platform linux/amd64 --build-arg FFMPEG_ST=yes \
      --build-arg EXTRA_CFLAGS="-O3 -msimd128" \
      --output type=local,dest=ffmpeg-core-output ffmpeg-core-build

The generated Dockerfile follows the release Dockerfile and the Makefile's make prd flags. It replaces the Git downloads with the verified snapshots, supplies the zimg submodule, uses the identified Emscripten 3.1.40 image by digest, and supplies the SDL2 archive expected by that SDK. The container still uses its public Linux package repositories for autoconf, automake, libtool, pkg-config and ragel. The recorded Emscripten and emsdk source archives cover compiler glue and the sources and licensing for the SDK's linked runtime components. The compiler binaries are supplied by the referenced public SDK image. Upstream testing repositories that the release recipe does not build are outside the source reconstruction.

The build exports dist/esm/ffmpeg-core.js and dist/esm/ffmpeg-core.wasm under ffmpeg-core-output, along with the upstream UMD variant. The delivered JavaScript file is the ESM variant. On the site the ESM WASM is served as a gzip file. To make an equivalent gzip locally:

    gzip -n -9 -c ffmpeg-core-output/dist/esm/ffmpeg-core.wasm > ffmpeg-core.wasm.gz

Check manifest.json for the SHA-256 and size of the shipped JavaScript and the uncompressed WASM. Differences in the compiler environment or compression can affect resulting bytes. The npm package does not carry a per-input attestation for its historical build. The archives here use the released build recipe and the published source refs resolved to specific revisions.

