xpra icon
Bug tracker and wiki

Version 36 (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, Quadro K4000 and up, ..) or a card which has the NVENC chip (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.

Using NVENC

If the nvenc codec loads, it will be used ahead of x264 when you specify the h264 encoding, you can verify the encoder in use with:

xpra info | grep "encoder="

Note: your xpra version must be either 0.15 or newer. (older versions require the full CUDA SDK and a more complicated setup)

To force xpra to use nvenc as video encoder and no other, you can also 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 ...

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

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