x265 is a software encoder for the HEVC/H.265 format, and it runs on CPU cores. At its slower presets it gets more quality out of each byte than hardware encoders such as NVIDIA’s NVENC. NVENC wins on UHD throughput and on power. In our reading, a CPU-bound x265 stage in a GPU-accelerated video analytics pipeline is a stage-boundary decision to price, not a defect to remove. In our judgement, four things decide which encoder belongs at the boundary: how often the output will be watched or stored, whether the job is live, whether the GPU has an encoder at all, and what it costs to move frames across the stage boundary. A profile of the pipeline is what settles it.
TechnoLynx’s view is that when a production video AI system runs into cost or latency pressure, the levers usually sit below the model, and replacing the detector is rarely the fix.
How Does the x265 Encoder Work, and What Does That Mean in Practice?
MulticoreWare launched the x265 project in 2013 with the aim of building the most efficient, highest-performance HEVC encoder. Our MulticoreWare explainer covers the company and its wider codec work. According to the project’s documentation, HEVC offers up to twice the compression of H.264/AVC.
Google’s ASPLOS 2021 paper describes encoding as a hard search problem, often taking orders of magnitude longer than decoding, because the encoder searches a large space of parameters to express the same content in fewer bytes. x265 runs that search on CPU cores. The preset sets how many cycles it spends.
Presets Set the Price of Every x265 Encode
The encoder has ten presets that trade encoding speed against compression efficiency, and medium is the default. Slower presets test more encoding options and spend more computation to reach better quality at a given bitrate, or a lower bitrate at a given CRF quality. Faster presets take shortcuts.
Jan Ozer’s Streaming Learning Center tests at 1080p show how quickly the gains flatten out. medium reached 97.7% of veryslow’s VMAF score in 6% of the encoding time. slow reached 99.7% in 15% of the time. slower came within 0.03 VMAF points of veryslow in 59% of the time. In his step-by-step tuning of the ladder, moving from medium to slower was the biggest step, adding 2.16 VMAF points and 8.5 times the baseline configuration’s encoding time. In those 1080p tests, slow already came within 0.3% of veryslow’s VMAF score. Anything slower has to be justified by how many times the output will be watched, and we come back to that below.
Why x265 Saturates CPU Cores and Then Stops Scaling
By default, the encoder allocates one thread per hyperthreaded core on each NUMA node. It uses two kinds of parallelism. The first is Wavefront Parallel Processing (WPP), where each row of coding tree units (CTUs) is encoded in parallel as long as it stays at least two CTUs behind the row above. The documentation says WPP typically delivers only 30% to 50% of perfect threading, because of stalls. The second is frame threading, where each frame ends up about three CTU rows behind its reference frames.
The number of CTU rows in a frame limits this. With WPP disabled, the encoder defaults to min(cpuCount, ctuRows / 2) frame threads, and the documentation warns that adding frame encoders beyond that often reduces performance. HEVC’s largest CTU is 64 × 64 pixels, so a 1080-line frame has 17 CTU rows (1080 / 64 = 16.9, rounded up). With 17 rows, that default works out to 8 frame threads (17 / 2, rounded down).
The zerolatency tune sets --frame-threads 1 and disables frame parallelism, which the documentation calls an important part of x265’s performance.
What Is the Difference Between x265 CPU Encoding and NVENC on the GPU?
NVENC is a dedicated block on the GPU die, present since the Kepler generation and separate from the CUDA cores. Offloading the encode to it leaves both the CUDA cores and the CPU free for other work. NVENC exposes four tuning modes (high quality, low latency, ultra-low latency, lossless). Each mode has seven presets, from P1 (fastest) to P7 (slowest).
The quality gap comes from silicon design limits. An arXiv evaluation of GPU hardware encoders notes that hardware implementations omit or modify features such as B-frames, reference frame counts and rate-distortion optimisation. As a result, they usually trail software encoders such as libx265 on rate-distortion performance. BlazingCDN makes the same point from the delivery side: hardware encoders narrow HEVC’s advantage because they skip the expensive rate-distortion searches where much of the gain lives.
| Dimension | x265 on CPU | NVENC on GPU |
|---|---|---|
| Where it runs | General-purpose CPU cores, frame and wavefront threading | Dedicated encoder block, independent of CUDA cores |
| Quality per bit at slow presets | Higher than hardware at the same bitrate | Cannot match the best software presets |
| Quality at real-time presets | Comparable to hardware | Similar to medium software presets |
| Low-latency HEVC speed (mean fps, mixed 1080p/4K test set) | 33 fps at ultrafast with zerolatency |
211 to 492 fps depending on preset |
| UHD real-time | Insufficient throughput even on a high-end desktop CPU | Sufficient up to 4K at the slowest preset |
| Power | Total system power about double the hardware encoder’s at the best software preset | Lower power per encode |
| Concurrency limits | 8 sessions per system on non-qualified GPUs (NVIDIA NVENC application note) |
When Is x265 the Better Choice Despite Being CPU-Bound?
Against x264, x265 earns its extra encode cost when the output is watched enough times to repay it in bandwidth. Encoding should move to the GPU when the job is live, runs at UHD in real time, or needs many streams per box. Google’s warehouse-scale paper describes a similar split by video popularity. Video popularity follows a stretched power law: for the most popular videos it is worth spending extra processing to cut bandwidth, while for the long tail it makes sense to minimise transcoding and storage cost.
Live work points towards hardware encoders. In the arXiv tests, a laptop Core i7-13700H could keep up with 1080p60 in real time with libx265 only at the faster preset. Software encoders could not sustain UHD throughput at all, even on a high-end desktop CPU. BlazingCDN estimates that most live operators use hardware HEVC encoders and accept a smaller gain, often 20 to 30 percent.
Primcast, a GPU hosting provider, cites NVIDIA’s support matrix as listing zero NVENC encoders on the A100 and H100. Those GPUs can decode, but every encoded frame has to come from the CPU. On an analytics server built around those cards, encoding falls to the CPU, with x265 or another software encoder. The real question there is how many host cores it can have.
Decision Table: x265 or NVENC at the Encode Boundary
| Situation | Lean towards | Why |
|---|---|---|
| VOD or archive output watched or retrieved many times | x265 | Enough viewing hours repay the extra encode through bandwidth saved |
| Evidence clips or long-tail output rarely viewed | The cheapest encode path | For the long tail it makes sense to minimise storage and transcode cost |
| Live ingest or real-time analytics output | NVENC | Low-latency x265 loses frame parallelism |
| UHD in real time | NVENC | CPU software cannot sustain UHD throughput |
| A100 or H100 inference server | x265 or another CPU encoder | No NVENC on those GPUs |
| Frames already decoded into GPU memory, NVENC present | NVENC | Avoids PCIe copies of raw frames |
| Frames already processed on the host by CPU filters | Profile first | PCIe may become the bottleneck with CPU filters |
How Do x265’s Compression Gains Translate into Storage and Egress Savings?
Better compression cuts delivered bytes in proportion to the bitrate saving and the share of viewing it reaches. That makes the number of views the variable that decides the case. BlazingCDN puts HEVC’s saving over H.264 at roughly 30 to 50 percent lower bitrate at matched quality, with the largest gains at 4K and HDR. It also warns that net savings depend on your per-terabyte delivery rate, and that cheap metered delivery may not cover the extra encoding and storage. AWS’s GPU-versus-CPU encoding benchmark found that CPU encoders produced smaller files than NVENC even at similar perceived quality. AWS advises weighing compute cost against data transfer and storage cost before choosing.
Worked Example: When a Slow x265 Encode Pays Back
The published figures we work from here compare tuned x265 with tuned x264, not with NVENC. They show how the break-even works, but they do not give an NVENC answer directly. In Ozer’s tests on an AWS c7i.8xlarge instance at $1.428 per hour, optimised x264 cost about $3.99 to encode per hour of content and optimised x265 about $29.77. The extra cost is therefore $29.77 − $3.99 = $25.78 per hour of content, paid once at encode time. In his 1080p tests, tuned x265 cut bandwidth by 16% to 27% against tuned x264, depending on the audience. That saving repaid the extra encode after about 3,215 viewing hours for a top-heavy audience and about 10,025 for a mobile audience. At $0.02 per GB, Ozer puts the saving at over $800K per 100M hours of top-heavy distribution.
For an analytics pipeline, our judgement turns on how often an output is viewed: annotated clips reviewed a handful of times do not repay a slow preset, while a broadcast archive or a published highlights catalogue might. The direction holds against NVENC, because at slow presets software encoders give higher quality than hardware at the same bitrate, and AWS found CPU output files smaller. The exact break-even point against NVENC has to be measured on your own content.
How Does Forcing an Encode Onto the GPU Create Acceleration Discord at the Stage Boundary?
Moving the encode onto NVENC pays best when the frames are already on the GPU. If they are not, the copy across PCIe can cost more than the encode saves. NVIDIA’s NVENC programming guide recommends running all or most of the pipeline (decode, compute and encode) on the GPU to reduce PCIe transfers. NVIDIA’s FFmpeg transcoding guide adds that copying uncompressed frames quickly saturates the PCIe bus. Keeping decoded frames in GPU memory with -hwaccel cuda -hwaccel_output_format cuda gives up to 2x the throughput of the unoptimised path. The same guide notes that CPU filters can make PCIe the bottleneck.
The friction arises when a pipeline does its pre-processing or overlay rendering on the host, for example with OpenCV, and someone then moves only the final encode to hevc_nvenc. Every raw frame now makes a trip to the device that it never needed under x265. The broader pattern of host-device copies and format conversions between disagreeing stages is the subject of hardware acceleration discord in video pipelines.
NVIDIA also cautions that its own throughput guidelines can cost some encode quality, and recommends evaluating the balance between quality, speed and memory. Split-frame encoding, for instance, speeds up a single session but degrades quality.
How Does the x265-Versus-NVENC Decision Affect Cost-per-Analytics-Hour and Throughput-per-GPU-Hour?
The encode choice changes cost per analytics hour in two ways. It decides whether the GPU hour you pay for is spent on inference, and whether the host can feed that GPU fast enough. NVIDIA states that NVENC and NVDEC run without slowing CUDA workloads running at the same time. So on a GPU that has NVENC, the encode does not slow CUDA work running alongside it.
AWS found a price-performance gain for GPU encoding in the scenarios it tested. AWS measured about 82% better price/performance for H.265 batch encoding with NVENC on a g4dn.xlarge than with x265 on a c6i.4xlarge, and about 79% for H.265 streaming. In the same benchmark, the larger p5 GPU family did not offset its higher cost. Google’s 2021 paper reported a smaller gain for an off-the-shelf GPU: a 1.5x perf/TCO improvement for H.264, with cost driven by GPU features that video encoding does not use. A GPU bought for encoding alone is a different case from a GPU that already sits in the pipeline for inference.
The opposite risk sits on A100 or H100 boxes, which have no NVENC. In accelerated transcoding, Google’s paper notes, host cores still handle networking, muxing, demuxing and audio. That is a hidden cost of GPU underutilisation that never shows up as an encode problem. As our page on hardware HEVC encoding and when it pays off puts it, faster per frame is not the same as cheaper per stream at a held quality target.
How Does a GPU Performance Audit Decide Whether x265-on-CPU or NVENC-on-GPU Is the Correctly Priced Encode Stage?
TechnoLynx’s GPU Performance Audit, scoped to video analytics workloads, profiles the encode stage boundary. It shows whether x265 on the CPU or NVENC on the GPU is the correctly priced choice, rather than assuming the GPU is always cheaper. It starts from the measured pipeline, because a rule like “keep everything on the GPU” only makes sense in a specific context, and profiling is what supplies that context. TechnoLynx offers this audit to teams in media, broadcast and telecom.
Profiling the encode boundary covers these steps:
- Confirm what the hardware can do. Check whether the GPUs have NVENC at all, and query encoder capabilities through the NVENCODE API before relying on any feature.
- Measure where time and bytes go.
nvidia-smi dmonreports NVENC, NVDEC and overall GPU utilisation, and profilers track GPU operations, memory transfers and CPU load. - Find the stage-boundary copies. Profile the encode stage boundary for frames moving out to CPU filters and back.
- Match the metric to the tune. When scoring x265 with PSNR or SSIM, use the matching
--tuneoption, because the encoder tunes for perceived quality by default. - Price both placements. Compute cost per stream on one side, storage and egress over the expected views on the other.
Each lever here sits below the model, where TechnoLynx looks for cost and latency improvements before recommending model replacement. Where a slow-preset x265 stage is starving a GPU, the fix may be fewer x265 threads, a faster preset for low-value outputs, or moving low-view outputs to a separate NVENC path. It may not be a wholesale move to the GPU.
The Answer Needs Re-Checking with Each Hardware Generation
The arXiv study found negligible rate-distortion improvement between hardware encoders released over the past six years. Newer hardware mostly gained from new codecs. NVIDIA reports that its Blackwell NVENC in UHQ mode makes AV1 encoding comparable to software AV1 at about 3x the throughput. That claim is about AV1, not HEVC, so it does not settle the x265 question. It does mean the quality gap that justifies x265 today is not fixed. The placement should be re-priced whenever the GPU fleet or the codec changes, through the same profile, as part of the wider work on stages that disagree in video pipelines.
FAQ
Is There a Difference Between x265 and H.265?
H.265 (HEVC) is the compression format, and x265 is one piece of H.265 encoder software producing streams in that format.
Which NVIDIA GPUs Have NVENC?
NVIDIA GPUs from the Kepler generation onward include NVENC. Primcast, citing NVIDIA’s support matrix, reports that the A100 and H100 data-centre GPUs have no NVENC encoders.