r/PleX•
Adarnof

Trouble with nvidia hardware-accelerated transcoding on docker

Help

I'm having trouble with hardware acceleration on my openmediavault 6 system. Initially I had assumed this was an issue with HDR tonemapping, as enabling it dramatically increases CPU usage (see here, where CPU usage is halved when I turn it off), however upon closer inspection it would appear that the transcoder is not using hardware-accelerated encoding at all. The dashboard shows this, with only (hw) present on the source. Running nvidia-smi dmon -s u confirms activity only on the decoder, not the encoder, as seen here, regardless of HDR tonemapping setting.

To the best of my knowledge everything is set up right. I'm using a Tesla P4 which according o the GPU Support Matrix should be able to decode and encode HEVC 4:2:0 10-bit HDR. I'm using nvidia driver 525.60.13 with CUDA 12.0 (shown here with nvidia-smi, taken while transcoding), which should support hardware-accelerated HDR tonemapping according to this support article.

My docker container is based on plexinc/pms-docker, however I have also tried with linuxserver/plex to no avail. The container is created with NVIDIA_DRIVER_CAPABILITIES=all and NVIDIA_VISIBLE_DEVICES=all using the nvidia runtime installed via these instructions.

My CPU is only barely able to keep up with encoding, and only after having increased the cTDP of my EPYC 3251 like this guy did. I'd much rather rely on hardware acceleration as the CPU is getting a bit toasty.

Any suggestions for further troubleshooting? I figure if hardware-accelerated deocding is working, I must be close. Yes, the setting for hardware-accelerated encoding is enabled, and yes I have an active plex pass.

EDIT: filtering the logs when starting a transcode, I see an interesting message: [Req#773/Transcode] [FFMPEG] - Cannot load libnvidia-encode.so.1 - this looks to be the issue.

SOLVED: using apt-file search for the missing libnvidia-encode.so.1 revealed a package which could be installed from the nvidia apt repositories called libnvidia-encode1. After installing and restarting docker to be safe, hardware acceleration is now working for encoding and decoding. NVENC usage confirmed with nvidia-smi

Posted Jan 11, 2023, 9:58 PM UTC · edited

02
idioteques•

When I was attempting to manage my own Docker environment on NVIDIA Jetson devices (which are ARM based) I had to pull down their version of Docker. Assuming you're using x86, I don't know whether this would matter. (A snip of the code I use)

case `sudo lshw -C systemshw -C system | grep product | awk -F\:\  '{ print $2 }' ` in
  'NVIDIA Jetson Xavier NX Developer Kit')
    # Common tasks
    sudo apt -y install python3-pip cmake curl
    distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
      && curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
      && curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
    sudo apt-get -y install nvidia-docker2
2
AdarnofOP•

Yes, that's more-or-less how I installed the nvidia docker runtime - absolutely necessary for getting hardware transcoding working.

2