{{{#!div class="box" [[Image(http://xpra.org/icons/nvidia.png)]] = NVENC Encoder = This encoder offers [http://xpra.org/stats/NVENC/ the best latency], which is most noticeable at higher resolutions (1080p and up). See [/wiki/Encodings/nvenc/Performance]. }}} {{{#!div class="box" == Hardware == This encoder requires a [https://developer.nvidia.com/nvidia-video-codec-sdk#gpulist 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) }}} {{{#!div class="box" == Software Requirements == You must have [http://mathema.tician.de/software/pycuda/ PyCUDA] installed, and a recent enough version of the nvidia drivers. How you install those drivers is entirely up to you: * [http://www.nvidia.com/object/unix.html nvidia installers] * [http://negativo17.org/nvidia-driver/ negativo17 repository] * [http://rpmfusion.org/ rpmfusion] * [http://elrepo.org/tiki/tiki-index.php 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}}}. }}} {{{#!div class="box" == 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 [/wiki/CSC#Scaling CSC/Scaling] for details on how to configure scaling. }}} {{{#!div class="box" == 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 ... }}} }}} {{{#!div class="box" == 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) }}} {{{#!div class="box" == Building == * Download the [https://developer.nvidia.com/cuda-downloads 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) * [http://wiki.tiker.net/PyCuda/Installation/Linux Install PyCuda] version 2015.1 or later (using your distribution's package manager if possible) * Download the [https://developer.nvidia.com/nvidia-video-codec-sdk 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: [/attachment/wiki/Encodings/nvenc/nvenc4.pc 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 }}} [[BR]] 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 [/ticket/370#comment:14 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 }}}