Build an FFmpeg hardware-accelerated transcoding pipeline choosing between NVENC, VAAPI, and VideoToolbox based on the host platform

domain: ffmpeg.org · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Check available hardware acceleration methods with ffmpeg -hwaccels and available hardware encoders with ffmpeg -encoders, filtering for nvenc, vaapi, or videotoolbox
  2. On NVIDIA hosts, decode with -hwaccel cuda -hwaccel_output_format cuda and encode with h264_nvenc or hevc_nvenc, using scale_cuda/scale_npp for any resizing so frames stay on the GPU instead of round-tripping to system memory
  3. On Linux with VAAPI, set -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format vaapi on decode and encode with h264_vaapi or hevc_vaapi, using scale_vaapi for in-pipeline resizing
  4. On macOS, decode with -hwaccel videotoolbox where supported and encode with h264_videotoolbox or hevc_videotoolbox, keeping in mind rate control is coarser than software x264 (no true multi-pass CRF)
  5. Avoid mixing hardware-surface frames with CPU-only filters (drawtext, overlay, etc.) unless you explicitly hwdownload/hwupload around them, since that round-trip can dominate pipeline cost
  6. Benchmark hardware encoder output quality-per-bit against a software x264/x265 reference at the same bitrate before committing, since fixed-function encoders typically trade some quality for speed

Known gotchas

Related routes

Configure low-latency CMAF chunked fMP4 live packaging with FFmpeg and a simple origin
ffmpeg.org · 6 steps · unrated
Run FFmpeg's loudnorm two-pass workflow for accurate EBU R128 loudness normalization
ffmpeg.org · 6 steps · unrated
Build a two-pass ffmpeg H.264 encode for constrained bitrate delivery
ffmpeg.org · 5 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans