C.W.K.
Stream
Lesson 01 of 08 · published

Hardware Acceleration Setup

~12 min · hardware, setup, verify

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

Three checks before you trust a hardware encoder

  1. Is the encoder compiled in? ffmpeg -encoders | grep <name>. Homebrew/apt builds enable VideoToolbox/NVENC/QSV by default in 2026, but custom builds may not.
  2. Does the kernel/driver expose the device? ffmpeg -hwaccels lists what's available. On Linux/NVIDIA, you also need a recent driver and CUDA libraries.
  3. Does it actually run? Encode a 5-second clip and watch wall-clock time and quality. A misconfigured pipeline silently falls back to software encoding — at the same flags.

Per-platform checklist

  • Apple Silicon — VideoToolbox is in every Homebrew build. Just works.
  • Linux + NVIDIA — install the proprietary driver + nvidia-cuda-toolkit. Verify with nvidia-smi; FFmpeg sees NVENC/NVDEC after that.
  • Linux + Intel iGPU — install intel-media-driver (or i965-va-driver); verify with vainfo. FFmpeg uses qsv or vaapi.
  • Windows + NVIDIA / AMD — drivers + CUDA toolkit (NVIDIA) or AMF SDK (AMD). Most builds work out of the box.

Code

Verify each platform·bash
# Apple Silicon
ffmpeg -hide_banner -hwaccels
# Hardware acceleration methods:
# videotoolbox
ffmpeg -encoders 2>/dev/null | grep videotoolbox
# V..... h264_videotoolbox    VideoToolbox H.264 Encoder
# V..... hevc_videotoolbox    VideoToolbox H.265/HEVC Encoder
# V..... prores_videotoolbox  VideoToolbox ProRes Encoder

# NVIDIA
ffmpeg -hide_banner -hwaccels  # → cuda, cuvid
ffmpeg -encoders 2>/dev/null | grep nvenc
# h264_nvenc, hevc_nvenc, av1_nvenc (RTX 40-series+)

# Intel
ffmpeg -hide_banner -hwaccels  # → qsv, vaapi
vainfo                         # Linux only — confirms kernel-side support
Compare HW vs SW on the same source·bash
# Software baseline
time ffmpeg -y -i in.mp4 \
  -c:v libx264 -preset slow -crf 20 -pix_fmt yuv420p \
  -c:a copy out_sw.mp4

# Hardware
time ffmpeg -y -i in.mp4 \
  -c:v h264_videotoolbox -b:v 6M -pix_fmt yuv420p \
  -c:a copy out_hw.mp4

# Compare file sizes and play both. The HW one should be 5–15× faster.
ls -lh out_sw.mp4 out_hw.mp4

External links

Exercise

On your platform, list every hardware H.264/HEVC encoder available (ffmpeg -encoders | grep -E 'videotoolbox|nvenc|qsv|amf'). Pick one and run the SW vs HW benchmark above with time. Note the speed ratio and file size delta. Save these numbers — they'll inform every 'how should I encode this' decision going forward.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.