xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.

Version 38 (modified by Antoine Martin, 7 years ago) (diff)


[[Image(...)]] NVENC Encoder

This encoder offers the best latency, which is most noticeable at higher resolutions (1080p and up).


This encoder requires a supported NVIDIA graphics card:

  • Tesla onwards cards: Quadro K4000 and up, .. (no license key required)
  • Some consumer cards (ie: GTX 680, GTX 750 and up for sure) and a license key (best with SDK version 4 or older)

Software Requirements

You must have PyCUDA installed, and a recent enough version of the nvidia drivers. How you install those drivers is entirely up to you:


If your CUDA (libcuda.so) or NVENC (libnvidia-encode.so) libraries are installed in an unusual location, it is your responsibility to ensure they can be loaded at runtime, usually by adding the directory to the LD_LIBRARY_PATH.

Note: xpra version 0.15 or newer is required. (older versions require the full CUDA SDK at runtime and contain unfixable bugs)


If the nvenc codec loads properly, it will be used ahead of the x264 software encoder automatically (that's assuming that the encoding used is h264 - which is the default).

You can verify the video encoder in use with:

xpra info | grep "encoder="

Scaling: nvenc supports scaling natively, see CSC/Scaling for details on how to configure scaling.


To force xpra to use nvenc exclusively as video encoder, you can use the --video-encoders= command line option:

xpra start :10 --video-encoders=nvenc

To debug the loading of video encoders, you can run the following scripts which are installed with xpra:

  • xpra/codecs/loader.py
  • xpra/codecs/video_helper.py
  • xpra/codecs/nv_util.py

Once nvenc is running, you can debug the encoding process step with:

xpra start -d nvenc ...

License Keys

As of version 0.15, you can store the license keys in nvenc.keys, either globally in /etc/xpra/ or per-user in ~/.xpra/.

Or you can also use the environment variable:

XPRA_NVENC_CLIENT_KEY="0A1B2C3D-4E5F-6071-8293-A4B5C6D7E8F9" xpra ...


  • Download the CUDA SDK and install it. If present, you should remove any previously installed nvidia drivers: both "nouveau" and nvidia's proprietary drivers - either install the drivers bundled with CUDA or a sufficiently recent version, preferably directly from nvidia (ie: 331.20, 331.49 and 334.21 are known to work with the version 3 SDK - 331.79 and 337.12 require a different set of license keys, more information here: #595)
  • Download the cuda.pc pkgconfig file (missing from the SDK) and install it (usually /usr/lib/pkgconfig or /usr/lib64/pkgconfig on some 64-bit systems)
  • Install PyCuda
  • Download the NVENC SDK, aka "NVIDIA VIDEO CODEC SDK" and install it (just unzip into /opt/), then create a symlink named just /opt/nvencV (where V is the SDK version, ie: nvenc4). You may want to stick with SDK versions 3 or 4 if you plan on using consumer cards with a license key, as the SDK version 5 removes the ability to use keys (see #825).
  • Download the pkgconfig file matching your SDK version (ie: nvenc4.pc) and install it (same location as the cuda.pc)
  • When building xpra, nvenc support should be auto-detected, but you can try forcing it to verify, ie: for version 4:
    ./setup.py install --with-nvenc4


  • you may need to adjust some paths
  • If CUDA refuses to build and complains about:
    Installation Failed. Using unsupported Compiler.
    run the CUDA installer with "-override-compiler" or "--override" for newer SDK.
  • there are undocumented incompatibilities between kernel versions, nvidia driver versions and nvenc SDK versions. If possible, install the driver version bundled with the nvenc SDK. For more details see here If you ignore this warning, you may get undecipherable errors at runtime (incompatible structure version errors, etc)

Attachments (6)

Download all attachments as: .zip