Software Requirements

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.

Using NVENC

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.

Debugging

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

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 ...

Newer SDK versions may not support keys, or just not the same set of keys, in which case the number of sessions will be limited when using consumer cards. (for purely commercial reasons, not technical ones)

Building

Download the ​CUDA SDK and install it (tested with versions 5 through to 7). 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 (more details below)

​Install PyCuda version 2015.1 or later (using your distribution's package manager if possible)

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

Notes:

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)

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