Installation
Install Package
bash
npm install ffmpeg-forgebash
yarn add ffmpeg-forgebash
pnpm add ffmpeg-forgeInstall FFmpeg
ffmpeg-forge requires FFmpeg 4.0 or higher to be installed on your system.
Ubuntu/Debian
bash
sudo apt update
sudo apt install ffmpegVerify installation:
bash
ffmpeg -versionmacOS
Using Homebrew:
bash
brew install ffmpegWindows
Option 1: Chocolatey
bash
choco install ffmpegOption 2: Manual
- Download from ffmpeg.org
- Extract to a folder (e.g.,
C:\ffmpeg) - Add to PATH environment variable
Docker
dockerfile
FROM node:18
RUN apt-get update && apt-get install -y ffmpeg
COPY . .
RUN npm installCustom FFmpeg Path
If FFmpeg is not in your system PATH:
typescript
import { FFmpeg } from 'ffmpeg-forge';
FFmpeg.setFFmpegPath('/custom/path/to/ffmpeg');
FFmpeg.setFFprobePath('/custom/path/to/ffprobe');
const ffmpeg = new FFmpeg();Verify Installation
typescript
import { FFmpeg } from 'ffmpeg-forge';
const ffmpeg = new FFmpeg();
// Get FFmpeg version
const version = await ffmpeg.getVersion();
console.log(`FFmpeg ${version.version}`);
// Check capabilities
const capabilities = await ffmpeg.getCapabilities();
console.log(`Formats: ${capabilities.formats.muxing.length}`);
console.log(`Video codecs: ${capabilities.videoCodecs.encoders.length}`);Hardware Acceleration Setup
NVIDIA (NVENC)
Install NVIDIA drivers and CUDA:
bash
# Ubuntu
sudo apt install nvidia-driver-580 nvidia-cuda-toolkitVerify:
bash
nvidia-smiIntel (Quick Sync)
Install VAAPI drivers:
bash
# Ubuntu
sudo apt install intel-media-va-driverAMD (AMF)
Install AMD drivers:
bash
# Ubuntu
sudo apt install mesa-va-driversTroubleshooting
FFmpeg not found
If you get "FFmpeg not found" error:
- Check FFmpeg is installed:
which ffmpeg - Set custom path:
typescript
FFmpeg.setFFmpegPath('/usr/local/bin/ffmpeg');Hardware acceleration not working
Check available hardware acceleration:
typescript
const hwInfo = await ffmpeg.getHardwareAccelerationInfo();
console.log('Available:', hwInfo.available);
console.log('Types:', hwInfo.types);Next Steps
- Quick Start - Common use cases
- Filters Guide - Apply video and audio effects
- Hardware Acceleration - GPU encoding setup