camera.ui ffmpeg package
npm install @camera.ui/ffmpegIntelligent FFmpeg binary downloader with automatic platform detection and hardware optimization for camera.ui.
``bash`
npm install @camera.ui/ffmpeg
The FFmpeg binary will be automatically downloaded during installation based on your system.
`typescript
import { ffmpegPath, isFFmpegAvailable } from '@camera.ui/ffmpeg';
// Get FFmpeg binary path
const ffmpeg = ffmpegPath();
console.log('FFmpeg path:', ffmpeg);
// Check if FFmpeg is available
if (isFFmpegAvailable()) {
console.log('FFmpeg is ready to use');
}
`
The package automatically selects the optimal FFmpeg binary based on:
For Linux, the package detects your distribution and downloads optimized binaries:
- Debian 11 (Bullseye)
- Debian 12 (Bookworm)
- Ubuntu 20.04 (Focal)
- Ubuntu 22.04 (Jammy)
- Ubuntu 24.04 (Noble)
- Generic - Fallback for other distributions
typescript
// Automatically detects:
// - Intel/AMD GPUs via lspci
// - VAAPI render nodes (/dev/dri/render*)
// - Intel CPU for QuickSync support
// - libva version compatibility
`$3
`typescript
// Automatically detects:
// - Raspberry Pi (bcm2835 driver, /dev/video* devices)
// - Rockchip SoCs (device tree, dmesg)
// - ARMv6/v7/hardfp architecture variants
`Environment Variables
Control binary selection with environment variables:
`bash
Force generic builds (disable distribution detection)
FORCE_GENERIC=true npm installUse Jellyfin optimized builds
USE_JELLYFIN=true npm installPrefer VAAPI compatible versions
PREFER_VAAPI_COMPATIBLE=true npm installCross-compilation support
npm_config_os=linux npm_config_cpu=arm64 npm install
`Binary Selection Logic
The package uses intelligent selection logic:
1. Active Binary - If marked as
active: true
2. Rockchip Priority - For Rockchip devices
3. Hardware Compatibility - VAAPI/V4L2M2M support
4. Distribution Match - OS-specific builds
5. Version Priority - Highest compatible version
6. Standard/Jellyfin - Based on USE_JELLYFIN flagExamples
$3
`typescript
import { ffmpegPath } from '@camera.ui/ffmpeg';
import { spawn } from 'child_process';const ffmpeg = spawn(ffmpegPath(), [
'-i', 'input.mp4',
'-c:v', 'libx264',
'output.mp4'
]);
`$3
`typescript
import { ffmpegPath } from '@camera.ui/ffmpeg';// The downloaded binary automatically includes
// hardware acceleration support for your platform:
// - NVENC (NVIDIA)
// - VAAPI (Intel/AMD Linux)
// - QuickSync (Intel)
// - VideoToolbox (macOS)
// - V4L2M2M (Raspberry Pi)
`$3
`typescript
import { isFFmpegAvailable, ffmpegPath } from '@camera.ui/ffmpeg';if (!isFFmpegAvailable()) {
console.error('FFmpeg not found. Run: npm install @camera.ui/ffmpeg');
process.exit(1);
}
console.log('Using FFmpeg at:', ffmpegPath());
`Platform Examples
$3
`bash
Automatically detects Pi and downloads V4L2M2M optimized build
npm install @camera.ui/ffmpeg
`$3
`bash
Detects Intel GPU and downloads VAAPI compatible version
npm install @camera.ui/ffmpeg
`$3
`bash
Downloads ARM64 build with VideoToolbox support
npm install @camera.ui/ffmpeg
`$3
`bash
Detects Ubuntu 22.04 and downloads Jammy-specific build
npm install @camera.ui/ffmpeg
`Troubleshooting
$3
If automatic detection fails:
`bash
FORCE_GENERIC=true npm install @camera.ui/ffmpeg
`$3
`bash
Force specific platform/architecture
npm_config_os=linux npm_config_cpu=x64 npm install
`$3
The installer logs detected platform information:
`
Detected platform: linux / x64 / jammy / VAAPI/QSV
Using Jellyfin FFmpeg v7.1.1-jellyfin (VAAPI/QSV compatible)
`$3
- Permission errors - Binary is automatically made executable on Unix
- Missing libva - Falls back to software-only builds
- Unknown distribution - Uses generic Linux builds
- Cross-compilation - Set npm_config_os and npm_config_cpuBinary Sources
Binaries are downloaded from the official camera.ui FFmpeg repository:
- Repository:
seydx/ffmpeg-static
- Version: 0.0.9
- Format: Compressed ZIP archives
- Verification: GitHub release checksumsDevelopment
`bash
Clone repository
git clone https://github.com/camera-ui/ffmpegInstall dependencies
npm installRun installer
npm run installCheck binary
npm run test
``Contributions are welcome! Please read our contributing guidelines and submit pull requests to our repository.
MIT
---
Part of the camera.ui ecosystem - A comprehensive camera management solution.