NVIDIA GTX 770 hardware transcoding on Debian 9

server-linux

#1

Trying out hardware support on Debian 9 and I can only get the encode side to work with the GTX 770. I get these errors repeated a few times for the encode in the log:

DEBUG - Codecs: hardware transcoding: testing API vaapi
ERROR - [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).
DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Input/output error

Then:

DEBUG - TPU: hardware transcoding: enabled, but no hardware decode accelerator found
DEBUG - TPU: hardware transcoding: zero-copy support not present
DEBUG - TPU: hardware transcoding: final decoder: , final encoder: nvenc

So I wind up with Transcode h264 to h264 (hw) in the Now Playing status window.

I have the latest stable nvidia-driver packages installed, and the output from nvidia-smi is:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.66                 Driver Version: 375.66                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 770     Off  | 0000:03:00.0     N/A |                  N/A |
| 20%   43C    P8    N/A /  N/A |      2MiB /  4036MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID  Type  Process name                               Usage      |
|=============================================================================|
|    0                  Not Supported                                         |
+-----------------------------------------------------------------------------+

I do not have a recent CPU that supports QSV in the server, so the only encoder/decoder is the GTX 770. Is decode limited to QSV only?

Thanks!


#2

If your processor does not support QSV then what you have is the limit at this time.
https://support.plex.tv/hc/en-us/articles/115002178853-Using-Hardware-Accelerated-Streaming


#3

But you guys enabled nvenc in the latest 9.3 release? It works for me. On my GeForce GTX 650 Ti. I get this in the transcoder log, and it's noticeably faster, and my GPU heats up :P.

<Variant id="932ddf01-5bb0-48cd-9e36-635179ed4b3b" context="static" sourceVideoCodec="h264" sourceAudioCodec="ac3" videoDecision="transcode" audioDecision="copy" protocol="http" container="mp4" videoCodec="h264" audioCodec="ac3" audioChannels="6" transcodeHwRequested="1" transcodeHwEncoding="nvenc" transcodeHwEncodingTitle="NVIDIA" transcodeHwFullPipeline="0">

To be clear, you're using the latest closed source drivers from NVIDIA?


#4

May I have all the logs? Settings - Server - Help - Download Logs


#5

I've just confirmed with the transcoder team.

Currently, functionality on Nvidia and AMD is best-effort. It is a 'Your mileage may vary' situation.


#6

@ChuckPA said:
If your processor does not support QSV then what you have is the limit at this time.
https://support.plex.tv/hc/en-us/articles/115002178853-Using-Hardware-Accelerated-Streaming

I've read that link several times but it does not give the granularity I asked about. It lists NVIDIA as supported under Linux but does not say encode (but no decode). What might I need to install to support decode, if supported? I'm happy with it being "YMMV" and encode only right now, but just curious and I'm sure others have the same question.


#7

[Edit] -- going to check on my settings, one sec


#8

Our focus for this release is Intel Quick Sync Video. Have you reviewed the support page?

https://support.plex.tv/hc/en-us/articles/115002178853-Using-Hardware-Accelerated-Streaming

NVidia and AMD are freebee sweep ups for those who have taken the time to install it on their systems but it's not guaranteed. The holdup for video on Linux has always been Intels libvaapi library. After 2.0.0 is formally released (it's 2.0.0 pre-release now), we will know more .

This, plus the status of the i915 driver is what gates HAS (Hardware Accelerated Streaming) for us.


#9

For what it's worth, I CAN confirm the encode working (the majority of the CPU intensity in a transcode operation)... however, yes I'm getting the same error as you in the Plex Media Server log for what I assume is the decode operation.

cat Plex\ Media\ Server* | grep -i VAAPI

gives me all sorts of results


#10

I think the issue is that Plex is (attempting) to use VAAPI to decode the video. VAAPI is not supported by NVIDIA cards. VDPAU must be used. As long as it is trying to use VAAPI it will fail.


#11

@zabby39103 said:
I think the issue is that Plex is (attempting) to use VAAPI to decode the video. VAAPI is not supported by NVIDIA cards. VDPAU must be used. As long as it is trying to use VAAPI it will fail.

Did you try the package vdpau-va-driver and the included va api to vdpau wrapper?


#12

libvaapi is used.

Engineering is tracking Intel's development of 2.0.0

When it comes out (released) they will see how much more can be done.


#13

On Linux, an Intel CPU supporting Quick Sync is required for hardware-accelerated decoding. NVIDIA GPUs are only supported for encoding.


#14

@uglymagoo Hey thanks. I checked that out. I have the latest installed version of vdpau-va-driver, set LIBVA_DRIVER_NAME=vdpau in /etc/environment, and ran vainfo successfully (so it should work...).

However, "Failed to initialise VAAPI connection" still occurs. Perhaps Plex is using it's own driver instead of the system provided one... I'm not sure.

(I know that any functionality would not be officially supported but it was fun to try)

vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG4Simple : VAEntrypointVLD
VAProfileMPEG4AdvancedSimple : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD

Also I could use emulated VAAPI with mpv

Playing: input.mkv
(+) Video --vid=1 () (h264)
(+) Audio --aid=1 --alang=eng (
) (eac3)
Subs --sid=1 --slang=eng (subrip)
libva info: VA-API version 0.39.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'vdpau'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/vdpau_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
[vo/vaapi] VA-API is most likely emulated via VDPAU.
[vo/vaapi] It's better to use VDPAU directly with: --vo=vdpau
Using emulated hardware decoding API.
AO: [pulse] 48000Hz 5.1(side) 6ch float
Using hardware decoding (vaapi).
VO: [vaapi] 1920x1080 vaapi
AV: 00:00:06 / 01:21:22 (0%) A-V: 0.000


#15

PMS does use its own library files. Regardless of what may be available, LD_LIBRARY_PATH is redefined immediately prior to PMS launch


#16

Plex tries, vaapi, nvenc, etc. to see if they’re supported. Then it uses whatever works (not sure about what priority but my guess is vaapi/qsv would be the first pick since it is officially supported). If all fail, it uses sw

The problem with nvidia decoding is that plex built their ffmpeg with support for the nvenc encoder, but not the cuvid decoder. That’s why it does hw encode, but sw decode

EDIT: what I wrote above applies to Linux. On windows, plex uses dxva to hw decode on nvidia, so it doesn’t need to use cuvid. But dxva is windows only.

EDIT2: see this post about the plex transcoder (ffmpeg) build details: https://forums.plex.tv/discussion/comment/1496184/#Comment_1496184


#17

@aptalca thanks for the interesting details… if it is something as simple as the build options on Plex’s ffmpeg, hopefully it can be fixed in a future release!


#18

If I may remind everyone?

This first release of hardware transcoding focused on Intel QSV. Whatever the host OS was able to augment with was the bonus.

When libva 2.0 is released, Engineering will have a much greater degree of freedom & flexibility.

There are a lot of plans already but nothing can move forward until after Intel releases 2.0 and it becomes a known entity (many api/abi changes)


#19

Not that it’s probably needed, but +1 to $any_cpu+NVIDIA card.

Oct 20, 2017 10:42:29.897 [0x7f4e08bfe700] ERROR - [FFMPEG] - No VA display found for device: .
Oct 20, 2017 10:42:29.898 [0x7f4e08bfe700] ERROR - [FFMPEG] - No VA display found for device: /dev/dri/renderD128.
Oct 20, 2017 10:42:29.933 [0x7f4e08bfe700] ERROR - [FFMPEG] - Cannot init CUDA
Oct 20, 2017 10:42:29.934 [0x7f4e08bfe700] WARN - avcodec_open2 returned -1313558101 for encoder 'h264_nvenc'

drivers/cuda appear happy

root@plex1:~/Logs# nvidia-smi 
Fri Oct 20 10:48:47 2017       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 381.22                 Driver Version: 381.22                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 430      Off  | 0000:04:00.0     N/A |                  N/A |
| 52%   33C   P12    N/A /  N/A |      0MiB /   964MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

#20

I just checked out this thread. It seems like libva 2.0 is released. Hopefully we can see the implementation soon.

I read that Nvidia GPU does not support decoding. Is it still the case after libva 2.0? I don’t have Intel QSV because I am running a server CPU. Am I still able to use hardware acceleration?