Requirements
- Node.js 18 or higher (or Bun 1.0+)
- FFmpeg libraries (libavcodec, libavutil, libswscale, libswresample)
- pkg-config (for finding FFmpeg during build)
- C++ compiler (Xcode Command Line Tools on macOS, build-essential on Linux)
Platform-Specific Setup
- macOS
- Ubuntu/Debian
- Windows
- Docker
macOS Installation
Install FFmpeg and pkg-config via Homebrew:~/.zshrc or ~/.bashrc):M1/M2/M3 Mac Users
M1/M2/M3 Mac Users
On Apple Silicon Macs, Homebrew installs to
/opt/homebrew by default. Make sure this is in your PATH:Intel Mac Users
Intel Mac Users
On Intel Macs, Homebrew installs to
/usr/local. Ensure /usr/local/bin is in your PATH:Install node-webcodecs
First build may take 2-3 minutes as native bindings compile against your FFmpeg installation.
Verification
Verify your installation works:Troubleshooting
Error: Cannot find module 'node-webcodecs'
Error: Cannot find module 'node-webcodecs'
The native module failed to compile. Check that:
- FFmpeg libraries are installed (
brew list ffmpegordpkg -l | grep libavcodec) - pkg-config can find FFmpeg (
pkg-config --modversion libavcodec) - You have a C++ compiler installed
Error: Library not loaded: libavcodec
Error: Library not loaded: libavcodec
FFmpeg libraries aren’t in your dynamic library path.macOS:Linux:Add to your shell profile (
.zshrc, .bashrc) to make permanent.Error: pkg-config not found
Error: pkg-config not found
Install pkg-config:macOS:Ubuntu/Debian:Windows:
Build takes forever or fails
Build takes forever or fails
If the native compilation is failing or taking too long:
- Check you have enough RAM (compilation needs ~2GB)
- Try cleaning node_modules:
- Check compiler version (GCC 7+ or Clang 5+ recommended)
Using prebuilt binaries
Using prebuilt binaries
v1.0.0+ includes prebuilt binaries for:
- macOS (arm64, x64)
- Linux (x64)
Runtime Support
Node.js 18+
Full support for Node.js 18.x, 20.x, 22.x
Bun 1.0+
Full compatibility via N-API
Next Steps
Quick Start Tutorial
Get your first video encoding in 5 minutes