xpra icon
Bug tracker and wiki

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



Version 37 (modified by Antoine Martin, 6 years ago) (diff)

--

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

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

Hardware

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

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: nvidia installers, negativo17 repository, rpmfusion, elrepo, etc..

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)

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

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

Building

  • 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 - 337.12 probably requires SDK version 4 or different keys, 331.79 also works but may require newer license keys, more information here: #595)
  • Download the cuda.pc pkgconfig file (missing from the SDK) and install it (usually in /usr/lib64/pkgconfig for 64-bit systems)
  • Install PyCuda
  • Download the latest NVENC SDK (aka "NVIDIA VIDEO CODEC SDK") and install it (just unzip into /usr/local/ - then create a symlink named just nvenc)
  • Download the nvenc.pc pkgconfig file (also missing from the SDK) and install it
  • Build xpra version with nvenc support:
    ./setup.py install --with-nvenc
    

Notes:

  • the files given here are for the current versions of the SDKs and for 64 bit systems only, adjust the files and locations accordingly
  • 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