Software x264 vs Hardware Encoders: Quality per Bitrate Compared
Compare libx264 with NVENC, VAAPI, QSV and VideoToolbox in FFmpeg 7.1 on your own footage using VMAF, and decide when speed or quality per bit should win.

The claim that software encoders beat hardware encoders on quality per bit is repeated so often that it has stopped being tested. It is true often enough to be a good default, and it is false often enough that a decision made on it alone can waste money or time. The honest answer depends on your footage, the GPU generation and the preset you compare, and no table of numbers from someone else's clips will settle it. This post gives the method, using FFmpeg 7.1 and the VMAF metric, so that you can measure the trade on your own material, followed by a decision table built on mechanisms rather than on scores. It does not quote benchmark figures, because any figure would describe a different machine from yours.
Why the two differ
A software encoder such as x264 runs on general-purpose cores. Its speed setting, from ultrafast to placebo, decides how many options it tries for each block, such as partition sizes, motion search range and reference frames. A slow preset tries a lot, and the file shrinks. The cost is time, and nothing in the design limits it.
A hardware encoder is a fixed-function circuit. Its designers chose the algorithms and the search effort in silicon, so the speed is high and almost constant, and the compression tools are a fixed set. Newer GPU generations improve the tools, which is why the same vendor's encoder can differ greatly between generations. Presets on hardware encoders, such as NVENC's p1 to p7, change how many of the circuit's features are used, within the limits of the design.
Two consequences follow. At the same bitrate, a slow x264 preset usually looks better than a hardware H.264 encode, because the software search finds more redundancy. And a hardware encode may need more bitrate to reach the same quality. Both are tendencies, not laws. The gap shrinks with newer hardware, with HEVC and AV1 encoders compared with their software counterparts and with simple content, and it can reverse against a fast x264 preset such as veryfast.
Measure with VMAF
VMAF is a perceptual quality metric from Netflix that predicts what viewers rate, and FFmpeg can compute it through the libvmaf filter if the build includes it. Check:
ffmpeg -hide_banner -filters | grep libvmaf ... libvmaf VV->V Calculate the VMAF between two video streams.The method has three steps. Pick a short representative clip, encode it several ways at matching bitrates, then score each against the original. Keep the clip to 30 to 60 seconds that contain both easy and hard scenes.
Encode the software reference. Use a bitrate target so the sizes can be matched, with two-pass for fairness:
ffmpeg -y -i clip.mp4 -c:v libx264 -preset slow -b:v 4M -pass 1 -an -f null /dev/null
ffmpeg -y -i clip.mp4 -c:v libx264 -preset slow -b:v 4M -pass 2 -an x264-4M.mp4Encode the same clip with a hardware encoder at the same bitrate. For NVENC:
ffmpeg -y -i clip.mp4 -c:v h264_nvenc -preset p7 -tune hq -rc vbr -b:v 4M -an nvenc-4M.mp4Score each against the source. The distorted file goes first and the reference second in the libvmaf filter:
ffmpeg -i x264-4M.mp4 -i clip.mp4 -lavfi "[0:v][1:v]libvmaf=log_fmt=json:log_path=x264.json" -f null -The last line of the log shows the pooled result in this format. The number here only shows the layout, and yours will differ:
[Parsed_libvmaf_0 @ 0x6000025b8000] VMAF score: 93.10Repeat for each encoder and for several bitrates, then plot score against bitrate. The curve for each encoder is the answer: at a given score, how many bits does each need? The horizontal distance between curves is the cost of hardware speed on your footage.
Some details protect the result from error. Both inputs must have the same resolution, frame rate and pixel format, or the filter fails or scores misaligned frames. Use a bitrate target for the comparison because constant-quality modes on different encoders do not map to each other. And check by eye as well: VMAF is a model, and it can be fooled by banding or by film grain that an encoder smooths away.
Mixed speed: compare at equal time, too
Quality per bit is one axis. The other is quality per second of encode time, which is what you pay for in practice. Time each encode with the shell, and compare a hardware encode to a faster x264 preset instead of only to slow:
time ffmpeg -y -i clip.mp4 -c:v libx264 -preset veryfast -b:v 4M -an x264-vf.mp4If x264 at a faster preset still beats the hardware file on score at the same bitrate and finishes within your time budget, the hardware encoder offers little for that job. If the faster preset loses clearly, the hardware gives you something. The result depends on the number of CPU cores, which is why you need to run it on the machine that will do the work.
Decision table
| Situation | Lean towards | Reason |
|---|---|---|
| Archive or master file, stored once, served for years | Software, slow preset | Every saved bit multiplies across storage and delivery |
| Live streaming with a fixed uplink | Hardware, CBR | Real-time guarantee and CPU left for the game or capture |
| Many parallel streams on one machine | Hardware | A CPU runs out of cores long before the encoder block does |
| Quick preview or proxy | Hardware | Quality is secondary and speed dominates |
| Delivery at a strict bitrate cap, such as a broadcast spec | Software, two-pass | Precise rate control and the best quality at a fixed rate |
| Laptop on battery | Hardware | Much lower power per encoded frame |
| HEVC or AV1 on a recent GPU | Measure | The gap to software is smaller and can be negligible |
Each row follows from a mechanism, and none is a score. Where the table says "measure", the method above is the answer.
Other costs that scores do not show
Hardware encoders can differ in behaviour that VMAF ignores. Some produce streams with fixed GOP structures that suit adaptive streaming without extra work, and some limit the number of B-frames or reference frames, which can matter to a decoder in a constrained device. Software encoders give you access to tools such as psychovisual tuning (-tune film, -tune animation) that have no equivalent on hardware. If your delivery target is a specific hardware decoder, test playback there, not only the score.
Operational costs matter too. A software encode scales by adding CPU cores or machines and is portable. A hardware encode needs particular GPUs, drivers and sometimes licences, and a session limit on some consumer cards. A mixed fleet can end up needing both code paths, so decide whether the speed is worth maintaining two.


