Plex HW acceleration in LXC container - anyone with success?

The guide worked great and deployed successfully. However, I am seeing an issue where power consumption reported by nvidia-smi stays elevated after the transcode streams have ended. Restarting the plex media server service allows the card to return back to normal idle.

Has anyone else experienced this?

Host: Proxmox 6.1-8 (Kernel 5.3.18-3)
Container: Ubuntu 19.10
Plex Version: 1.19.1.2645
GPU: GTX 1660
Nvidia Driver: 440.82

GPU Idle Power: 6~7W
GPU Transcode (single stream): 27W
GPU After Transcode Ends: 20W

root@Plex:~# nvidia-smi
Sun Apr 12 15:12:48 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 1660    Off  | 00000000:08:00.0 Off |                  N/A |
| 45%   35C    P0    20W / 120W |     12MiB /  5942MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
root@Plex:~# systemctl restart plex*
root@Plex:~# nvidia-smi
Sun Apr 12 15:13:00 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.82       Driver Version: 440.82       CUDA Version: 10.2     |
|-------------------------------+----------------------+----------------------+
| 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 1660    Off  | 00000000:08:00.0 Off |                  N/A |
| 45%   34C    P8     7W / 120W |      0MiB /  5942MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
root@Plex:~# 

It looks as though the GPU’s power state is stuck in P0 and not returning to P8.

–

EDIT: Nevermind, found the large thread about the documented power states issue.

So I went and checked and am getting nvenc encoding and decoding in my TPU logs without the card or renderer permissions.

Wonder if it could be related to multiple display adapters in your system? I only have the one GPU in mine.

Does anyone have any success with an Intel NUC8i3 setup to expose the GPU to the VM/LXC with promox ?

Interesting. I guess this just shows how every setup requires slightly different settings/tuning to properly work. I won’t be able to take out the Matrox card as it’s directly soldered on the motherboard. Thanks for checking your config though!

I’m trying to set it up here on my NUC i5, I can’t get it up and running (tried to first guide), it just fails starting the container. I’ve then looked at @constiens guide, but that’s primarily for nvidia cards.
Anybody that has some ideas on a way that works for intel gfx cards?

I got it started, not sure what I did different, could be that the ubuntu 19.10 isn’t goot, but with 18.04 it seems to at least load, now I need to test to see if HW accelleration is working

I have been working on this and did the walkthru for the nvidia install. It seemed to be working but i never saw any activity on nvidia-smi. So I found out that my intel integrated gpu is doing the work. In order for Plex to see it transcoding i ended up bringing over /dev/dri/card0, /dev/dri/card1, /dev/dri/renderd128 and finally /dev/dri/renderd129. So it turns out card0 is the intel card and card1 is nvidia. I tried to map card1 to card0 and renderd129 to renderd128 in the LXC container but Plex still didn’t work with the nvidia. Is there a way to test if Nvidia is actually working? For now I have Intel gpu doing transcoding but would like to get my nvidia p400 doing the work. I do have all the /dev/ns* stuff listed on both proxmox and lxc container.

Hi,

Thanks for a nice guide. I have followed your guide except and added patch as I have p2000 card and it is not necessary for me.

When I try and run transcoding from my samsung tv I get error message PLAYER_ERROR_CONNECTION_FAILED

But if I try and transcode with my mobile phone then I get no error message and everything works as it should.

I have tried and transcode from a friend’s set up and everything works on my tv.

Anyone know what could be wrong or how to troubleshoot this?

Hi,

Thanks for a nice guide. I’ve been following your guide (Plex HW acceleration in LXC container - anyone with success?) except and add patch since i have p2000 short and it is not necessary for me. I also installed a newer driver. 440.82

When I try and run transcoding from my samsung tv I get error message PLAYER_ERROR_CONNECTION_FAILED

But if I try and transcode with my mobile phone then I get no error message and everything works as it should.

I have tried and transcode from a friend’s set up and everything works on my tv.

Anyone know what could be wrong or how to troubleshoot this?

From my googling, this is a pretty common problem with Samsung TV’s and nothing really to do with transcoding.

Some links for you: Plex TV v2 Beta for Samsung 2016+ UHD Devices - #42 by sLumpy

You might try this: Samsung TV Unable to watch Plex - player_error_connection_failed - #19 by DMackG

From the link above:

These steps fixed the problem for me. 1) On the server PC, open Server → Network settings and disable “Secure Connections”. Required & Preferred do not work for me. 2) Uncheck “Enable server support for IPv6”, "Enable HTTP Pipelining ", "Webhooks ". 3)Turn off TV 4)Restart Plex server (I closed program on my PC, then re-opened it) 5)Turn on TV and reopen Plex app. 6) It Finally works!

Here’s my setup and I didn’t buy Plex Pass:
-PMS Version 1.5.5.3634
-Model UN60KU6270 - Samsung 60" (2016)
-Plex app for Samsung 3.0.11 (3.1.0) downloaded thru TV from Samsung app store

Hope this helps you guys


when i turn of hw transcode everything works as it should


check nvidia-smi works check /dev/nvidia* for nvidia0 nvidia-modeset nvidia-uvm nvidia-uvm toolkit

also check permissions if you still need help fallow my guide one setting up proxmox 6.2-1 for plex HW transcode support for nvidia

just want to say THANK YOU for sharing your setup.

Its working great here with a cheap low profile GT1030. Even though it says this card has no NVENC support it startet HW Transcoding of my 10bit HDR HEVC content with one of the latest Plex Version. Proxmox with PMS in LXC is just awesome!

Regards,

Dom

edit: Just realized that the linked nvidia Matrix from keylease shows that my GT1030 is able to decode x265 10bit HDR. However this has never happen before when I ran PMS on a Windows Server Setup.

found this in plex server log files:
Jun 11, 2020 12:48:13.461 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Loaded Nvenc version 9.1
Jun 11, 2020 12:48:13.461 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Nvenc initialized successfully
Jun 11, 2020 12:48:13.491 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Nvenc unloaded
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] DEBUG - Codecs: testing h264 (decoder) with hwdevice vaapi
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Rescanning for external libs: ‘/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/99c90e0-3095-linux-x86_64/’
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] DEBUG - Codecs: hardware transcoding: testing API vaapi
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Cannot open DRM render node for device 0.
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] VERBOSE - [FFMPEG] - Cannot open a VA display from DRM device (null).
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] DEBUG - Codecs: hardware transcoding: opening hw device failed - probably not supported by this system, error: Generic error in an external library
Jun 11, 2020 12:48:13.801 [0x7efd8f7fe700] DEBUG - Codecs: testing h264 (decoder) with hwdevice nvdec

[root@plex Logs]# ls -l /dev/nvidia*
crw-rw-rw- 1 65534 65534 195, 0 juni 11 11:58 /dev/nvidia0
crw-rw-rw- 1 65534 65534 195, 255 juni 11 11:58 /dev/nvidiactl
crw-rw-rw- 1 65534 65534 195, 254 juni 11 11:58 /dev/nvidia-modeset
crw-rw-rw- 1 65534 65534 235, 0 juni 11 11:58 /dev/nvidia-uvm
crw-rw-rw- 1 65534 65534 235, 1 juni 11 11:58 /dev/nvidia-uvm-tools

This is a red herring, vaapi is for Intel, I would expect it to fail.

What do the logs say after this: DEBUG - Codecs: testing h264 (decoder) with hwdevice nvdec

Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] VERBOSE - [FFMPEG] - Rescanning for external libs: ‘/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/99c90e0-3095-linux-x86_64/’
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - Codecs: hardware transcoding: testing API nvdec
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded lib: libcuda.so.1
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuInit
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuDeviceGetCount
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuDeviceGet
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuDeviceGetAttribute
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuDeviceGetName
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuDeviceComputeCapability
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuCtxCreate_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuCtxSetLimit
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuCtxPushCurrent_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuCtxPopCurrent_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuCtxDestroy_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemAlloc_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemAllocPitch_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemsetD8Async
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemFree_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemcpy2D_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuMemcpy2DAsync_v2
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuGetErrorName
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuGetErrorString
Jun 11, 2020 13:30:29.698 [0x7fa78d77c700] DEBUG - [FFMPEG] - Loaded sym: cuStreamCreate

Do you have any suggestions for what I can check or do?

let’s start off what piece of hardware you trying to use to do HW transcoding

for what i see it looks like writing permissions or permission in general

if your running it in proxmox make sure both host and client machine are listing the same dir looks to me that your not loading the environment variables correctly.