Hardware-Accelerated Encoding with NVIDIA and Intel
Software encoding using libx264 is CPU-intensive. For high-volume video processing (server-side transcoding), hardware encoders on your GPU can be 5x to 20x faster.
1. NVIDIA GPU Acceleration (NVENC)
If your system has an NVIDIA GPU and the correct drivers installed, you can use the h264_nvenc encoder:
# Encode using NVIDIA GPU hardware encoder
ffmpeg -i input.mp4 -c:v h264_nvenc -preset p4 -cq 24 -c:a aac output_nvidia.mp4-c:v h264_nvenc: Use NVIDIA's hardware H.264 encoder.-preset p4: NVIDIA presets range fromp1(fastest) top7(best quality).p4is a balanced default.-cq: Constant quality mode (similar to CRF for software encoders).
Verify NVENC is Available
# List hardware acceleration options
ffmpeg -hwaccels
# Check if nvenc encoders are listed
ffmpeg -encoders | findstr nvenc2. Intel Quick Sync Video (QSV)
For Intel processors with integrated graphics, use the h264_qsv encoder:
# Encode using Intel Quick Sync Video hardware encoder
ffmpeg -i input.mp4 -c:v h264_qsv -global_quality 24 -c:a aac output_intel.mp43. When to Use Hardware Acceleration
Hardware acceleration is ideal for:
- Server-side transcoding pipelines processing dozens of videos concurrently.
- Real-time streaming where low-latency encoding is critical.
- Encoding very large files (2K, 4K) where software encoding would take hours.
Published on Last updated: