Hardware encoding lost to a slideshow.
A 4K, 180-second clip encodes in 2.70 seconds on the CPU. The Tesla P40 took 16.11. The Intel UHD 770 took 3.21. That's the whole finding, and I spent 108 benchmark runs and two throwaway LXCs to reach it.
Here's the part that stings: I set out to prove my instinct wrong. I had a feeling that sending naptune's encodes to an idle P40 was over-engineering, and I built the rig specifically to catch myself being lazy.
The benchmark agreed with the instinct. Not for the reason I expected.
The workload
naptune.xyz takes a song and an image and gives you back a video — a 1-fps slideshow with the track as audio. That's the entire product. Someone uploads two files and wants an MP4.
The encode is ffmpeg's libx264 at ultrafast, on a tiny LXC on one of my Proxmox nodes. A 3-minute video takes about 5 seconds. Nobody is waiting on that.
Which is exactly why the P40 was tempting. It sits idle. It's famous in the homelab community for LLM inference (I wrote about that before), and what's less talked about is that it also carries an NVENC encoder: hardware H.264 that doesn't touch the CPU at all. Free capacity, already bought, already racked. The obvious idea is to point the queue at it.
The not-obvious part is that "free capacity" and "faster" are different claims, and only one of them survives a fair test.
Detour: getting the iGPU into an LXC
Before any of that, I needed a second hardware candidate, because NVENC-vs-CPU is a two-horse race and I wanted a third. pve05 has an Intel i7-13700T with a UHD 770. Intel Quick Sync is the other mainstream hardware encoder — in every modern Intel CPU, roughly zero watts at idle, H.264 and HEVC both.
The catch: my naptune-prod LXC can't touch that iGPU. Proxmox LXCs don't pass GPUs through by default. So I built a fresh LXC on pve05 — VMID 505, qsvbench — and passed /dev/dri into it.
The config lines that matter, in /etc/pve/lxc/505.conf:
features: nesting=1,keyctl=1
lxc.cgroup2.devices.allow: c 226:* rwm
lxc.cgroup2.devices.allow: c 29:* rwm
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir 0 0
lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file 0 0
lxc.apparmor.profile: unconfined
Each line is there because something failed without it.
nesting=1,keyctl=1 — I run Docker inside this LXC. Without both, Docker doesn't start.
c 226:* rwm — 226 is the DRM major. Bind-mounting the device and allowing it are two separate permissions, and I had the first one working while the container still couldn't open it.
c 29:* rwm — the framebuffer, matching the /dev/fb0 bind.
apparmor.profile: unconfined — AppArmor blocks GPU access in some setups. Unconfined is the pragmatic homelab answer, and I'm not going to pretend it's elegant.
bind,optional,create=dir — so a missing device doesn't stop the container from booting.
After pct reboot 505, inside the container:
ls /dev/dri
card0 renderD128
The render node is there. vainfo — from intel-media-va-driver plus i965-va-driver — showed the H.264 High Profile encoder available on renderD128.
The P40 side is the same idea with NVIDIA's devices: /dev/nvidia0, /dev/nvidiactl, /dev/nvidia-uvm, plus c 195:* rwm, c 235:* rwm, c 238:* rwm. It also needed the NVIDIA userspace libraries copied in — libcuda.so.1, libnvidia-encode.so.1, libnvcuvid.so.1 — with the driver version matching the host's.
That's roughly 6 lines of config per container. The gap between "the iGPU is unusable from a container" and "the iGPU is available to every container on this node" is smaller than I assumed.
The benchmark
I replicated naptune's production ffmpeg command exactly — image2 loop at 1 fps, scale-to-even, matroska output, AAC 128k — and ran it three ways:
- CPU — libx264, ultrafast, crf 23 (naptune's current path)
- P40 NVENC — h264_nvenc, preset p4, cq 23
- Intel UHD 770 VAAPI — h264_vaapi, qp 23
VAAPI is the API and QSV is the marketing name; on Raptor Lake they hit the same media engine.
Corpus: 15 images (3 colors × 720p/1080p/4K) × 27 audio files (3 × 3 resolutions × 30/90/180s). 108 runs total, 54 on each benchmark LXC.
The results
Mean wall-clock, seconds. On the pve05 LXC (i7-13700T, UHD 770):
| res / dur | CPU (libx264) | UHD 770 VAAPI |
|---|---|---|
| 720p / 30s | 0.32 | 0.33 |
| 1080p / 90s | 0.87 | 0.94 |
| 4K / 180s | 2.70 | 3.21 |
| mean | 1.16 | 1.27 |
On the pve06 LXC (P40 + CPU):
| res / dur | CPU (libx264) | P40 NVENC |
|---|---|---|
| 720p / 30s | 0.83 | 1.10 |
| 1080p / 90s | 3.55 | 3.12 |
| 4K / 180s | 24.85 | 16.11 |
| mean | 6.71 | 5.08 |
Wait. Why is pve06's CPU so slow?
Because pve06 is a different machine with a much weaker CPU. That table is not a verdict on NVENC. It's a verdict on pve06.
Put the numbers side by side and the "P40 win" disappears: on pve05 — which matches naptune-prod's i5-13500T architecture — the CPU encodes the 4K clip in 2.7 seconds while VAAPI takes 3.2. The P40 would have to do 16.11 seconds of encoding plus a network round-trip, an API queue, auth and failure handling, and beat 2.7. It can't. It isn't close.
The verdict, as contrast pairs
The workload is trivial for any encoder, and that's the point. A 1-fps static-image slideshow has almost no motion, so every frame is mostly identical. libx264 ultrafast eats it for breakfast. The P40's raw speed only shows up on heavy motion at 4K — it can do 4K 60fps NVENC, and naptune doesn't need 4K 60fps.
The P40 "win" was an illusion. It beat a weak CPU on a box that isn't prod. That's the whole effect. Benchmarking hardware against the wrong baseline is how homelab folklore gets made.
NVENC session init costs ~0.3s on every run. Real money on a 1-second job. Hardware encoders charge an upfront fee, and the shorter your job, the worse the rate.
Intel VAAPI didn't win either — slower than CPU across the board, 1.27s against 1.16s on the mean.
Hardware encoding is not free performance. It's a tool with an initialization cost and a narrow sweet spot: motion, high resolution, high volume, or a weak CPU. Not a slideshow, and not a 14-core Raptor Lake chip.
Do the math on the network hop. Uploading a song and an image and downloading the MP4 back adds latency that can wipe out any encode saving. Keep the encode where the data is.
What I'm doing about it
Nothing. naptune stays on CPU — it's local, zero network, zero queue, zero new failure surface, and it doesn't break a sweat at current volume. That's a decision, not a TODO: I'm not revisiting it until the workload changes shape.
If naptune ever grows motion video or batch transcoding, the iGPU is the move — local to the LXC, no network hop, H.264 and HEVC both, sipping power. The P40 stays where it's genuinely valuable: LLM inference.
The iGPU is the underrated part of this whole exercise. It was already in the CPU. It cost roughly nothing at idle. Six lines of config and every container on that node can use it. If you have a Proxmox box with a modern Intel CPU, h264_vaapi (or h264_qsv) is a free hardware encoder you already own and probably aren't using.
Next I want the same corpus run against real motion video, and h264_qsv against VAAPI on that same iGPU — that's the workload where the hardware should win, and I'd rather measure it than assume it. If you've already run that comparison on Raptor Lake, send me the numbers and I'll add them to the table.