Hardware Encoding and GPUs
Every package of lamco-rdp-server 1.4.6, the Flatpak and the Snap included, is built with all three GPU encoders: VA-API, NVENC and Vulkan Video. Hardware encoding is on by default, and the server picks an encoder for the GPU it finds at startup. Where there's no GPU that encodes H.264, a native package encodes in software with OpenH264. This page says what the server chooses on each kind of machine, what to install, and how to change it.
By GPU
| GPU | Encoder chosen | What to know |
|---|---|---|
| Intel | VA-API | Install the media driver: intel-media-va-driver on Debian and Ubuntu. On Fedora the stock libva-intel-media-driver has no H.264 encoding; replace it with RPM Fusion's intel-media-driver. The server's log says when it finds the stock one. |
| AMD | Vulkan Video, then VA-API | Mesa 26.0.0 to 26.2.0 corrupts VA-API H.264 encoding on AMD, which is why Vulkan Video comes first there. The server warns when it finds one of those Mesa versions. VA-API needs mesa-va-drivers. |
| NVIDIA | NVENC, then Vulkan Video | NVENC needs NVIDIA's proprietary driver. The server loads its libraries when it finds them, so the same binary starts on hosts without the driver; nothing else is installed. |
| None, or a virtual machine | Native packages: OpenH264 in software. Flatpak and Snap: No H.264 | Native: Install OpenH264 if the distribution didn't. Fedora ships a placeholder; swap it with sudo dnf swap noopenh264 openh264. The Flatpak and the Snap can't see the system's OpenH264 from their sandbox; see OpenH264 for the Flatpak and the Snap. |
NVENC and Vulkan Video were tested in the native packages, the Flatpak and the Snap on an NVIDIA RTX 4060 with NVIDIA's driver in the 1.4.6 release test. Each encoder serves both AVC420 and AVC444, in full-range BT.709, and follows adaptive bitrate.
Check what the server chose
The server's log names the encoder it opened. To see what the GPU offers before you start the server:
vainfo
# NVIDIA: the driver is loaded and the GPU is visible
nvidia-smi
# The server's own view of the machine, including encoders
lamco-rdp-server --show-capabilities
The packages recommend vainfo, because the VA-API probe depends on it: Without it a host never detects VA-API.
OpenH264 for the Flatpak and the Snap
With no H.264 encoder at all, clients get RemoteFX Progressive, which costs more bandwidth and more processor time for the same picture. That's the Flatpak and the Snap on a machine without a GPU that encodes H.264, which includes most virtual machines. On a 3-core virtual machine at 1280x800 in the 1.4.6 release test, a full-screen frame took about 60 ms to encode and 250 KB to send, against 5 ms with hardware H.264, and moving video fell behind.
Cisco pays the H.264 patent royalties only for copies of its OpenH264 binary downloaded from Cisco, so neither package can include it. Download it into the package's own folder, unpack it there, and start the server again. For the Flatpak:
cd ~/.var/app/io.lamco.rdp-server/data/openh264
curl -O https://ciscobinary.openh264.org/libopenh264-2.6.0-linux64.8.so.bz2
bunzip2 libopenh264-2.6.0-linux64.8.so.bz2
For the Snap the folder is ~/snap/lamco-rdp-server/common/openh264, which a refresh keeps; the same curl and bunzip2 go there. The log then says "Loaded OpenH264 2.6.0 (ABI 8)", and until it finds one, the log names the folder to put it in. On the same 3-core virtual machine a full-screen frame then took about 24 ms to encode instead of 60, and video kept up at about 22 frames a second. Deleting the file undoes it.
On a machine like that, a native package is the simpler choice: It encodes in software with the system's OpenH264.
Codecs and who gets them
The server sends the picture over RDP's graphics pipeline (EGFX) and picks the codec from what the client can decode:
- AVC444: Full-chroma H.264 for clients that support it (mstsc, Windows App, FreeRDP with
/gfx:AVC444). Text and color edges stay sharp. - AVC420: Standard H.264 for clients without AVC444.
- RemoteFX Progressive: For clients that can't decode H.264, such as Android's RD Client and web clients built on IronRDP, and for any client when the server has no H.264 encoder.
- Planar: Lossless RDP 6.0 Planar for clients limited to EGFX 8.0, which decode neither H.264 nor Progressive. A whole 1280x800 desktop went from 4.1 MB as raw pixels to 94 KB.
- Bitmap updates: For clients without the graphics pipeline, compressed where the client shares a codec with the server.
Mixed-codec frames (lossless ClearCodec for text, H.264 for motion, in the same frame) are in the release behind [egfx.multicodec] enabled, off by default while they're being validated. They need a client at EGFX 10.4 or later. The video encoding technology page explains the pipeline.
Settings
enabled = true # false encodes in software
backend_priority = [] # empty: the GPU vendor's encoder first, then the others
# backend_priority = ["vaapi", "nvenc"] # pin an order; the first that opens wins
vaapi_device = "auto" # or a render node such as "/dev/dri/renderD129"
vulkan_device = "auto" # "discrete", "integrated", an index, or part of a name ("RTX 4060")
quality_preset = "balanced" # "speed", "balanced", "quality"
fallback_to_software = true
[egfx]
codec = "auto" # "avc420", "avc444", "auto"
avc444_enabled = true
[egfx.encoding_adaptation]
enabled = true # adaptive bitrate and QP, on by default from 1.4.6
A config file that turned hardware encoding or adaptive bitrate off keeps it off after the upgrade. prefer_nvenc is legacy and ignored; backend_priority decides the order, and the GUI's EGFX tab can reorder it. The configuration reference has every key.
When the encoding GPU isn't the display GPU
On a machine where the GPU that encodes isn't the one that drives the desktop, GTK4 applications can crash. The server sets GSK_RENDERER=cairo for the session when it detects that, through an environment.d drop-in for future logins and systemctl --user set-environment for the current one. Set capabilities.auto_mitigate_gpu_mismatch = false if you manage GSK_RENDERER yourself.
Screen capture buffers (DMA-BUF)
- The server takes DMA-BUF frames where the compositor offers a layout it accepts, and reads them through the CPU. On a machine with no GPU render node, and on a virtual GPU that can't share its buffers with the CPU, it takes memory buffers by itself; the log says which and why.
performance.zero_copy = falseforces memory buffers. Use it where capture gives a black or corrupted picture. In 1.4.5 nothing read this setting.enable_dmabuf_zerocopyis gone, and a config file that still has it gets a warning naming it.- GNOME sessions capture into memory buffers, because GNOME's screen cast offers DMA-BUF only in a layout the server doesn't take yet. That's planned for 1.5.0.
- Frames are copied once on the way to the encoder. Handing a GPU buffer straight to a hardware encoder is planned for 1.6.0.
Related
- RDP clients: which codec each client gets
- First start of the Flatpak and Snap
- Installation
- Configuration reference
- Known limits
- Video encoding technology