Fix Missing @ffmpeg/ffmpeg Wasm in OpenCut

If the editor logs Failed to load ffmpeg-core.wasm, the bundle cannot find the WASM core.

Checklist

  1. Install the package:
    bun add @ffmpeg/ffmpeg @ffmpeg/core
  2. Configure static file serving in next.config.mjs:
    const withTM = require('next-transpile-modules')(['@ffmpeg/ffmpeg', '@ffmpeg/core']);
    module.exports = withTM({
      webpack: (config) => {
        config.experiments = { ...config.experiments, asyncWebAssembly: true };
        return config;
      }
    });
  3. Reference the core explicitly:
    const ffmpeg = createFFmpeg({
      log: true,
      corePath: '/static/ffmpeg/ffmpeg-core.js'
    });
  4. Copy assets during build (e.g., using next.config.mjs rewrites or a build script).

Diagram

  flowchart LR
    A[createFFmpeg] --> B[ffmpeg-core.js]
    B --> C[ffmpeg-core.wasm]
    C --> D[Browser]

Host the WASM on a CDN like jsDelivr if you deploy to serverless targets that cannot serve large static files from the filesystem.