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
- Install the package:
bun add @ffmpeg/ffmpeg @ffmpeg/core
- 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; } });
- Reference the core explicitly:
const ffmpeg = createFFmpeg({ log: true, corePath: '/static/ffmpeg/ffmpeg-core.js' });
- 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.