A single 4K video can easily take 30+ minutes to encode on CPU. Switch to GPU encoding and the same job finishes in minutes. That kind of speed difference changes how you approach video work entirely.
FFmpeg uses the CPU by default. CPU encoding produces excellent quality but is slow. GPU encoders — NVIDIA's NVENC, Intel's QSV (Quick Sync Video), and AMD's AMF — trade some quality headroom for dramatic speed gains. This guide covers how to set up each one, the commands you actually need, and a real benchmark comparison to help you decide which fits your workflow.
The Limits of CPU Encoding
To understand why GPU encoding matters, it helps to know what makes CPU encoding slow.
A CPU is a general-purpose processor. Even high-end chips top out at a few dozen cores. Video encoding is a massively parallel workload, and crunching through it core by core takes time. Running x264 at the slow preset on a 4K clip can take 3 to 5 times longer than the video's actual runtime — that's not unusual.
GPUs are built differently. They have thousands of shader cores optimized for parallel computation. GPU encoders like NVENC go further by offloading compression to dedicated silicon — an encode engine built directly into the chip — that operates independently of shader cores and CPU usage.
The trade-off is compression efficiency. Dedicated encode hardware runs a simplified version of the compression algorithm compared to what a CPU encoder can execute. At the same bitrate, CPU encoding usually wins on quality. How much this matters depends on your use case — more on that in a later section.
Comparing the Three GPU Encoders
Here is a quick reference for what each encoder supports and where it runs.
| Encoder | Vendor | Target Hardware | FFmpeg Codec Names |
|---|---|---|---|
| NVENC | NVIDIA | GeForce GTX 16xx+, RTX 20xx+ | h264_nvenc / hevc_nvenc / av1_nvenc |
| QSV | Intel | iGPU (Gen 6+), Arc dGPU | h264_qsv / hevc_qsv / av1_qsv |
| AMF | AMD | Radeon RX 5000+ | h264_amf / hevc_amf / av1_amf |
All three run on dedicated encode engines and leave CPU cores free for other work. If you have both an Intel CPU with integrated graphics and a discrete NVIDIA GPU, you can run both encoders simultaneously on separate tasks.
AV1 encoding support has hardware requirements worth noting: NVIDIA RTX 4000+, Intel Arc, and AMD RX 7000+ are needed. Older GPUs are limited to H.264 and H.265.
NVIDIA NVENC: Setup and Usage
Verify Support
Check whether your FFmpeg build includes NVENC:
ffmpeg -encoders | grep nvenc
Expected output:
V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)
V....D hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)
V....D av1_nvenc NVIDIA NVENC av1 encoder (codec av1)
If nothing appears, either the FFmpeg build lacks NVENC support or your NVIDIA driver is outdated. Update to driver version 550 or later. You can find the full list of supported GPUs and features in the NVENC Application Note.
H.264 NVENC Encoding
ffmpeg -i input.mp4 \
-c:v h264_nvenc \
-preset p4 \
-cq 23 \
-b:v 0 \
-c:a copy \
output_nvenc_h264.mp4
Option breakdown:
-c:v h264_nvenc— selects the NVENC H.264 encoder-preset p4— quality/speed balance from p1 (fastest) to p7 (best quality)-cq 23— constant quality mode; lower values mean higher quality (18–28 is the practical range)-b:v 0— required to activate CQ mode by disabling a target bitrate
H.265 (HEVC) NVENC Encoding
When you need smaller files at equivalent quality, H.265 cuts file size by roughly 40–50% compared to H.264.
ffmpeg -i input.mp4 \
-c:v hevc_nvenc \
-preset p5 \
-cq 28 \
-tag:v hvc1 \
-c:a copy \
output_nvenc_hevc.mp4
The -tag:v hvc1 flag improves playback compatibility on Apple devices (iPhone, Mac, Apple TV).
Session Limits on GeForce GPUs
Consumer GeForce GPUs used to cap simultaneous NVENC sessions at three. NVIDIA relaxed this limit over time — as of 2024, most GeForce GPUs support up to eight concurrent encode sessions, and newer drivers push it to twelve. Quadro and RTX Professional cards have no artificial cap at all. If you are running batch encodes across multiple FFmpeg processes, check your driver version — older drivers may still enforce the stricter limit.
Intel QSV: Setup and Usage
Verify Support
ffmpeg -encoders | grep qsv
On Linux, QSV requires the Intel Media VA driver. Install it on Ubuntu with:
sudo apt install intel-media-va-driver-non-free vainfo
vainfo
vainfo should list supported encode/decode profiles. If it returns errors, the driver is missing or your kernel does not recognize the iGPU.
H.264 QSV Encoding
ffmpeg -i input.mp4 \
-c:v h264_qsv \
-preset medium \
-global_quality 23 \
-look_ahead 1 \
-c:a copy \
output_qsv_h264.mp4
-preset medium— QSV uses veryfast / faster / fast / medium / slow / veryslow-global_quality 23— QSV's equivalent of CRF; controls quality level-look_ahead 1— enables lookahead buffering for improved quality at a slight speed cost
QSV is the best choice when you have no discrete GPU. Intel's integrated graphics handle encoding with low power draw, which matters on laptops and fanless small-form-factor machines.
AMD AMF: Setup and Usage
Verify Support
ffmpeg -encoders | grep amf
On Windows, AMF works as soon as the Radeon driver is installed — no extra steps required. On Linux, AMF support is limited; the usual alternative is h264_vaapi or hevc_vaapi via the Mesa driver. See the AMF SDK wiki for recommended FFmpeg encoder settings.
H.264 AMF Encoding
ffmpeg -i input.mp4 \
-c:v h264_amf \
-quality balanced \
-qp_i 22 -qp_p 24 -qp_b 26 \
-c:a copy \
output_amf_h264.mp4
-quality balanced— AMF preset: speed / balanced / quality-qp_i / -qp_p / -qp_b— per-frame-type quantization parameters for I, P, and B frames
AMF currently trails NVENC and QSV on compression efficiency. AMD is improving it each GPU generation — the AMF SDK 1.4.36 update added B-frame support for AV1 — but H.264/HEVC quality still lags behind NVENC. AMF is well-suited for game capture and real-time streaming; for archival or mastering purposes it is not the first choice.
Quality vs. Speed Trade-offs
The central drawback of GPU encoding is that the dedicated silicon skips or simplifies the costly compression steps that CPU encoders perform — advanced motion estimation, exhaustive macroblock partitioning, and multi-pass analysis. At the same CQ/QP value, a GPU encoder will produce a larger file or lower visual quality than its CPU counterpart.
A practical decision guide:
| Use Case | Recommended Encoder |
|---|---|
| Real-time game capture / streaming | NVENC / QSV (speed priority) |
| YouTube upload transcode | NVENC p5–p6 / QSV slow (balanced) |
| Archival master creation | x264 / x265 slow (quality priority) |
| Blu-ray rip compression | x265 veryslow / SVT-AV1 (quality priority) |
| Bulk batch conversion | NVENC / QSV (throughput priority) |
For high-efficiency AV1 encoding on CPU, see the FFmpeg v8 + SVT-AV1 optimal settings guide.
Benchmark Comparison
The following numbers come from encoding a single 4K 30fps source clip (10 minutes) on Windows 11 with a Core i9-13900K, RTX 4080, and 32 GB RAM.
| Encoder | Preset | Encode Time | Output Size | VMAF Score |
|---|---|---|---|---|
| x264 | slow | 28m 14s | 2.1 GB | 94.2 |
| x265 | slow | 41m 03s | 1.2 GB | 94.8 |
| h264_nvenc | p5 | 2m 41s | 2.6 GB | 91.3 |
| hevc_nvenc | p5 | 2m 58s | 1.5 GB | 91.7 |
| h264_qsv | medium | 3m 22s | 2.8 GB | 90.1 |
| h264_amf | balanced | 3m 08s | 2.9 GB | 89.4 |
VMAF is Netflix's perceptual quality metric (0–100, higher is better). These are reference numbers only. Your results will vary significantly based on source content and GPU generation.
To benchmark your own system, add -benchmark to any FFmpeg command:
ffmpeg -i input.mp4 -c:v h264_nvenc -preset p5 -cq 23 -b:v 0 -c:a copy output.mp4 -benchmark
The flag prints CPU time and system time at the end of the run. Encode speed in real-time multiples appears in the log as speed=.
FAQ
Does GPU encoding always reduce video quality?
Not always, but at identical bitrates a CPU encoder typically delivers better compression. The gap narrows at higher bitrates. For most YouTube uploads and streaming, the quality difference is imperceptible. Where it matters most is in low-bitrate archival and animation — there, CPU encoding still wins.
Can I use NVENC and QSV at the same time?
Yes. If your machine has both an NVIDIA discrete GPU and an Intel CPU with integrated graphics, you can run NVENC on one encode and QSV on another simultaneously. They use separate hardware engines and do not interfere with each other.
Which GPUs support hardware AV1 encoding?
AV1 encoding requires NVIDIA RTX 4000 series (Ada Lovelace) or newer, Intel Arc GPUs, or AMD Radeon RX 7000 series. Older GPUs are limited to H.264 and H.265 encoding. On the decode side, AV1 support is broader.
Is GPU encoding good enough for live streaming?
GPU encoding is the standard for live streaming. OBS, Streamlabs, and most streaming software default to NVENC when available. The slight quality trade-off compared to CPU encoding is irrelevant at streaming bitrates (6–10 Mbps for 1080p), and the near-zero CPU overhead lets your game or application run smoothly.
How do I check if my FFmpeg build supports a specific GPU encoder?
Run ffmpeg -encoders | grep nvenc (or qsv or amf). If the encoder appears in the list, your build supports it. If nothing shows up, you need a different FFmpeg build or updated GPU drivers.
What CQ value should I use for NVENC?
For H.264 NVENC, CQ 20–23 gives high quality suitable for archiving. CQ 24–28 works well for streaming and sharing where file size matters. Below 18 produces diminishing returns and very large files. These values are not directly comparable to x264's CRF — NVENC CQ 23 does not equal x264 CRF 23.
Does GPU encoding still use the CPU?
The encoding itself runs on the GPU's dedicated engine. However, FFmpeg still uses the CPU for demuxing, audio processing, filtering, and muxing. For a straight transcode with no filters, CPU usage drops significantly. If you are applying complex video filters (scaling, deinterlacing, color correction), the CPU or GPU shader cores handle those before passing frames to the encoder.
Wrapping Up
GPU encoding makes the most sense when speed matters more than maximum compression efficiency. NVENC is the strongest all-around choice — it leads on quality, speed, and ecosystem support. QSV earns its place on laptops and power-constrained machines where a discrete GPU is not an option. AMF works fine for Windows-based game capture and streaming, though it still trails the others on compression quality.
For long-term archival and professional mastering, CPU encoding remains the right answer. But for batch conversion, real-time recording, and anything where throughput matters, switching to a GPU encoder is one of the highest-leverage changes you can make to your FFmpeg workflow.
If you have not installed FFmpeg yet, start with the FFmpeg installation guide.
Related articles:
- How to Receive, Convert, and Stream RTSP Camera Feeds with FFmpeg
- Building a Multi-Camera Surveillance Dashboard with FFmpeg
- The Complete Guide to Video Compression with FFmpeg
- AV1 vs H.265 vs H.264: Which Codec Should You Use?
- Build an FFmpeg Encoding Server on a VPS
- FFmpeg v8 + SVT-AV1: Optimal Encoding Settings for Production
- FFmpeg Commands: A Practical Guide from Basics to Advanced