| Crates.io | playa-ffmpeg |
| lib.rs | playa-ffmpeg |
| version | 8.0.3 |
| created_at | 2025-11-08 21:43:34.027108+00 |
| updated_at | 2025-11-09 08:48:00.150953+00 |
| description | Safe FFmpeg wrapper with vcpkg integration for simplified cross-platform builds (FFmpeg 8.0, Rust 2024) |
| homepage | https://github.com/ssoj13/playa-ffmpeg |
| repository | https://github.com/ssoj13/playa-ffmpeg |
| max_upload_size | |
| id | 1923317 |
| size | 657,808 |
Modified by: Alex Joss (joss13@gmail.com)
This is a modernized fork with cross-platform build improvements and vcpkg integration.
This crate uses vcpkg for FFmpeg dependency management with static linking.
Windows:
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
cd C:\vcpkg
.\bootstrap-vcpkg.bat
setx VCPKG_ROOT "C:\vcpkg"
Linux/macOS:
git clone https://github.com/microsoft/vcpkg.git /usr/local/share/vcpkg
cd /usr/local/share/vcpkg
./bootstrap-vcpkg.sh
export VCPKG_ROOT=/usr/local/share/vcpkg
# Add to ~/.bashrc or ~/.zshrc for persistence
Windows (MSVC) - Release only (faster builds):
First create a custom triplet for release-only builds:
# Create triplet file
$tripletContent = @"
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
"@
New-Item -Path "$env:VCPKG_ROOT\triplets\community" -ItemType Directory -Force
Set-Content -Path "$env:VCPKG_ROOT\triplets\community\x64-windows-static-md-release.cmake" -Value $tripletContent
# Install FFmpeg (release only - ~2x faster than default)
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-windows-static-md-release
Windows (MSVC) - Debug + Release (default):
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-windows-static-md
Linux:
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-linux-release
macOS (Intel):
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale]:x64-osx-release
macOS (Apple Silicon):
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale]:arm64-osx-release
Platform-Specific Notes:
| Platform | NVENC Support | Hardware Encoding Alternative | Build Time (Release-Only) |
|---|---|---|---|
| Windows | ✅ Enabled by default | N/A | ~10 min (first build) |
| Linux | ✅ Enabled by default | VAAPI (Intel/AMD) | ~15 min (first build) |
| macOS | ❌ Not available | VideoToolbox (Apple Silicon/Intel) | ~15 min (first build) |
Important Notes:
x64-windows-static-md-release triplet to skip debug builds (50% faster)bootstrap.cmd build
./bootstrap.sh build
See examples/README.md for detailed usage examples.
# Build and run video-info example
cargo build --example video-info --release
# List all available codecs (hardware + software)
cargo run --example video-info --release -- ls
Output:
Why use this:
The crate supports multiple hardware encoding/decoding backends through Cargo features:
[features]
default = ["codec", "device", "filter", "format", "software-resampling", "software-scaling", "nvenc"]
# Core FFmpeg components
codec = []
device = []
filter = []
format = []
software-resampling = []
software-scaling = []
# Hardware encoding/decoding (platform-specific)
nvenc = [] # NVIDIA NVENC/NVDEC (Windows/Linux only, enabled by default)
vaapi = [] # Intel/AMD VAAPI (Linux only)
videotoolbox = [] # Apple VideoToolbox (macOS only)
qsv = [] # Intel Quick Sync Video (Windows/Linux)
Usage examples:
# Default build with NVENC
cargo build --release
# Build without NVENC (software encoding only)
cargo build --release --no-default-features --features "codec,device,filter,format,software-resampling,software-scaling"
# Build with VAAPI for Intel/AMD GPUs on Linux
cargo build --release --features "vaapi"
# Build with VideoToolbox on macOS
cargo build --release --features "videotoolbox"
bootstrap build # Build release (default)
bootstrap build --release # Build release (explicit)
bootstrap build --debug # Build debug
bootstrap test # Run all tests
The crate uses a custom build.rs that:
VCPKG_DEFAULT_TRIPLET environment variable for custom tripletsVCPKG_ROOT is setRun tests to verify FFmpeg integration:
# All tests
bootstrap test
# Or directly with cargo
cargo test --examples
What it does:
Test output location: target/debug/ or target/release/
bootstrap crate # Dry-run (preview changes)
bootstrap crate publish # Publish to crates.io
Uses cargo-release - automatically installed on first use.
The GitHub Actions workflow is optimized for minimal build times:
First Build (cold cache):
Subsequent Builds (warm cache):
x64-windows-static-md-release triplet to skip debug buildsCache locations:
Linux/macOS:
- /usr/local/share/vcpkg/installed
- /usr/local/share/vcpkg/buildtrees
- /usr/local/share/vcpkg/downloads
- /usr/local/share/vcpkg/packages
Windows:
- C:\vcpkg\installed
- C:\vcpkg\buildtrees
- C:\vcpkg\downloads
- C:\vcpkg\packages
| Platform | Triplet | NVENC | Cache Key |
|---|---|---|---|
| Linux | x64-linux-release |
✅ | Linux-vcpkg-ffmpeg-nvcodec-v2 |
| macOS Intel | x64-osx-release |
❌ | macOS-x64-osx-release-vcpkg-ffmpeg-v2 |
| macOS ARM | arm64-osx-release |
❌ | macOS-arm64-osx-release-vcpkg-ffmpeg-v2 |
| Windows | x64-windows-static-md-release |
✅ | Windows-vcpkg-ffmpeg-nvcodec-release-only-v3 |
This is a fork of ffmpeg-next (originally based on the ffmpeg crate by meh.).
This fork focuses on modern Rust (2024 edition) with FFmpeg 8.0 support and simplified cross-platform builds via vcpkg.
NVENC support is enabled by default on Windows and Linux builds.
Requirements:
nvcodec feature in vcpkg FFmpeg installationRuntime behavior:
Not available on macOS (NVENC is NVIDIA-specific hardware).
nvcodec featureFor GitHub Actions or other CI environments:
env:
VCPKG_ROOT: /usr/local/share/vcpkg # Linux/macOS
# or C:\vcpkg on Windows
PKG_CONFIG_PATH: /usr/local/share/vcpkg/installed/{triplet}/lib/pkgconfig
- name: Install FFmpeg via vcpkg
run: |
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-linux-release
- name: Set environment variables
run: |
echo "PKG_CONFIG_PATH=/usr/local/share/vcpkg/installed/x64-linux-release/lib/pkgconfig" >> $GITHUB_ENV
echo "VCPKG_ROOT=/usr/local/share/vcpkg" >> $GITHUB_ENV
- name: Build
run: cargo build --release
Speed up CI builds with vcpkg caching:
- name: Cache vcpkg
uses: actions/cache@v4
with:
path: |
/usr/local/share/vcpkg/installed
~/.cache/vcpkg
key: ${{ runner.os }}-vcpkg-x64-linux-release-${{ hashFiles('.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-vcpkg-x64-linux-release-
Result: First build ~30-40 min, cached builds ~3-5 min.
[features]
default = ["codec", "device", "filter", "format", "software-resampling", "software-scaling", "nvenc"]
# Hardware encoding (nvenc enabled by default)
nvenc = [] # NVIDIA NVENC/NVDEC
vaapi = [] # Linux VA-API (optional)
videotoolbox = [] # macOS VideoToolbox (optional)
qsv = [] # Intel QuickSync (optional)
Build without NVENC:
cargo build --no-default-features --features codec,device,filter,format,software-resampling,software-scaling
| Platform | Triplet | Static Linking | NVENC |
|---|---|---|---|
| Windows MSVC | x64-windows-static-md |
✅ | ✅ |
| Windows MinGW | x64-mingw-static |
✅ | ✅ |
| Linux x64 | x64-linux-release |
✅ | ✅ |
| macOS Intel | x64-osx-release |
✅ | ❌ |
| macOS ARM64 | arm64-osx-release |
✅ | ❌ |
See CHANGELOG.md for version history and upgrade notes.