Can't get HW transcoding to work on Intel NUC w/ Ubuntu 20.04

Server Version#: 1.25.0.5282
Player Version#: 4.66.1

I’ve run PMS on various machines (Mac, Windows, Synology) for years without issue. However, I’m trying to learn more about Linux and decided to ditch Windows 10 on my Intel NUC (NUC8i7INH, 8th gen Core i7 with Quick Sync, Radeon 540X graphics, etc.) and use it as our Plex server. It’s running a basic install of Ubuntu 20.04. I installed PMS using Swizzin, so it’s not running in Docker. Everything works beautifully EXCEPT that I can’t get hardware transcoding to work. I’ve read as many threads as I can find, both here and elsewhere, but nothing suggested has helped and I’m at a loss as to what to do.

If anyone has any kind suggestions that don’t involve “just Google it” (which I’ve been doing off and on for weeks), I’d really appreciate some guidance. I’ll provide any additional info you need – just let me know what I need to share. Thanks in advance!

When you create a container, you must pass the device in the map

--device /dev/dri:/dev/dri

It’s a native install, I believe, rather than Docker, so no container.

Do you have udev installed ?

I will add. I don’t know what that software has done to your system but, as the packaging developer, I test on Debian & Ubuntu. Out of the box – it works.

It has a Intel CPU without the iGPU instead it has Radeon bolted on. It isn’t officially supported yet but you may find a workaround in this thread Got HW Transcoding to work with libva/vaapi on Ryzen APU (Ryzen 7 4700U)

Yes. I don’t know what to do with it, but it’s installed.

I’m (obviously) not a hardware guy. I was led to believe that the i7 had the iGPU built in, has Quick Sync, etc. and that’s why I went with this particular NUC. So no Quick Sync and only the Radeon 540X GPU?

Whatever the case, thanks for that pointer to the other thread. After copying the drivers from /usr/lib/… to /usr/lib/plexmediaserver/… as described there, I noticed this in the console log when playing a transcoded video:

Dec 01, 2021 10:07:41.212 [0x7fe43c44ab38] Error — [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 01, 2021 10:07:41.212 [0x7fe43c44ab38] Error — [Transcode] [FFMPEG] - Could not dynamically load CUDA
Dec 01, 2021 10:07:41.213 [0x7fe43c44ab38] Error — [Transcode] [FFMPEG] - libva: dlopen of /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so failed: Error loading shared library libLLVM-12.so: No such file or directory (needed by /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so)
Dec 01, 2021 10:07:41.213 [0x7fe43c44ab38] Error — [Transcode] [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).

Using info found elsewhere, I installed the libllvm12 package. That eliminated the above error, which was replaced with this:

Dec 01, 2021 10:13:32.537 [0x7fe43ca29b38] Error — [Transcode] [FFMPEG] - libva: dlopen of /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so failed: Error relocating /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so: fcntl64: symbol not found

After much research, I’m stuck and have no idea what to do next. My brain doesn’t absorb info as well as it did several decades ago, so maybe I’m overlooking something obvious. What was supposed to be a fun learning project is just turning into semi-expensive frustration. I appreciate your patience and help. Any further advice is welcome.

I’ve done more resarch. That is unforunately one of the NUCs without QSV.

I have the NUC8-i7-HVK (Hades Canyon). It has both QSV and the Radeon.

As linked above, Yes, you can use the Radeon GPU and it works well.
Follow the procedures carefully to enable VAAPI in Linux yourself and you’ll be good.

Plex will use the user-installed vaapi functionality.

The unfortunate part is that Engineering NEVER IMPLEMENTED any AMD support. :angry: I don’t know why either.

@ChuckPa Thanks for researching this! Can’t quite believe I ended up with a non-QSV machine despite what I thought was careful research and good advice. Just my luck.

That said, I already have VAAPI installed/enabled, so I don’t know why Plex doesn’t seem to be using it. Not sure if this will reveal any clues, but this is the output of ‘vainfo’:

brossow@NUC-UBUNTU:~$ vainfo
error: can't connect to X server!
libva info: VA-API version 1.12.0
libva info: User environment variable requested driver 'radeonsi'
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.12 (libva 2.12.0)
vainfo: Driver version: Mesa Gallium driver 21.2.0-devel for Radeon 540X Series (POLARIS12, DRM 3.42.0, 5.11.0-41-generic, LLVM 12.0.1)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSlice
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSlice
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSlice
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

FWIW, it was using the Radeon driver even before I manually set the environment variable as shown on one of the first few lines above. Since this isn’t a supported configuration, I’ll continue to research on my own. May pop in another drive and start from scratch or just give up on the NUC altogether if I can’t figure it out. Could be a new trick this old dog just wasn’t meant to learn. Thanks for all the suggestions!

  1. check the group and user for /dev/dri.

  2. you’re looking for any ‘render’ nodes, as in -

[chuck@lizum ~.2001]$ ls -la /dev/dri
total 0
drwxr-xr-x   3 root root        140 Nov 30 16:39 ./
drwxr-xr-x  22 root root       5180 Nov 30 16:39 ../
drwxr-xr-x   2 root root        120 Nov 30 16:39 by-path/
crw-rw----+  1 root render 226,   0 Dec  1 02:53 card0
crw-rw----+  1 root render 226,   1 Dec  2 09:32 card1
crw-rw----+  1 root render 226, 128 Dec  1 02:53 renderD128
crw-rw----+  1 root render 226, 129 Dec  1 02:53 renderD129
[chuck@lizum ~.2002]$ 

By default, Plex looks for /dev/dri/renderD128. If you have something else, we will manually set that preference.

Next, look at the group. The installer will add plex to that group if it detects the i915 and the node.

IF,

  • You have any render nodes in /dev/dri
  • examine the group colum
  • groups plex and verify user plex is a member of that.

IF,
You have the above but plex isn’t a member of the group (usually group ‘render’), add plex to that group.

It should be the command: usermod -a -G render plex

Lastly, if you’ve added Plex to the group - restart Plex so it picks up the new group membership.

Let me know if renderD128 isn’t the default render node.

Thanks for the quick reply! This is what I’m seeing:

brossow@NUC-UBUNTU:~$ ll /dev/dri
total 0
drwxr-xr-x   3 root root        100 Nov 30 17:25 ./
drwxr-xr-x  20 root root       4540 Dec  1 07:57 ../
drwxr-xr-x   2 root root         80 Nov 30 17:25 by-path/
crw-rw----+  1 root render 226,   0 Dec  1 09:43 card0
crw-rw----+  1 root render 226, 128 Dec  1 09:43 renderD128
brossow@NUC-UBUNTU:~$ groups plex
plex : plex video render brossow

It looks virtually identical to yours, and the plex user appears to be a member of the render group as expected.

I forgot :man_facepalming:

sudo bash
cd /usr/lib/plexmediaserver/etc

Add, /usr/lib/x86_64-linux-gnu/dri/ to ld-musl-x86_64.path so the radeon drivers get found. (.so files)

You might need tweak it a bit to get it perfect

On QNAP NAS systems, I construct the path dynamically based on GPU availability.

    # Construct ld-musl-x86_64.path
    {
     echo /lib
     echo /usr/lib
     echo /usr/local/lib
     echo /usr/local/cuda/lib64
    } > ${QPKG_DIR}/etc/ld-musl-x86_64.path

    # If GPU is supported (Has Drivers & Is Available)
    if [ $SUPPORTED_GPU -gt 0 ]; then

      # determine and write paths  (QTS & QuTS)
      GPU_DRV_DIR="$(echo /share/*/.qpkg/NVIDIA_GPU_DRV/usr/lib)"
      [ "$GPU_DRV_DIR" != "/share/*/.qpkg/NVIDIA_GPU_DRV/usr/lib" ] && echo $GPU_DRV_DIR >> ${QPKG_DIR}/etc/ld-musl-x86_64.path

      # Older versions
      if [ -d "/opt/NVIDIA_GPU_DRV" ]; then
        {
          echo /opt/NVIDIA_GPU_DRV/usr/syslib
          echo /opt/NVIDIA_GPU_DRV/usr/lib
          echo /opt/NVIDIA_GPU_DRV/usr/applib
        } >> ${QPKG_DIR}/etc/ld-musl-x86_64.path
      fi
    fi

I’ve done that, but I am still getting this error in the console log:

Dec 02, 2021 12:54:28.993 [0x7f1c725efb38] Error — [Transcode] [FFMPEG] - libva: dlopen of /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so failed: Error relocating /usr/lib/plexmediaserver/lib/dri/radeonsi_drv_video.so: fcntl64: symbol not found
Dec 02, 2021 12:54:28.993 [0x7f1c725efb38] Error — [Transcode] [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).
Dec 02, 2021 12:54:28.993 [0x7f1c725efb38] Error — [Transcode] [FFMPEG] - Cannot load libcuda.so.1
Dec 02, 2021 12:54:28.993 [0x7f1c725efb38] Error — [Transcode] [FFMPEG] - Could not dynamically load CUDA

It feels (“feels” is a legit troubleshooting technique, right?) like it would all just work if I could resolve whatever is causing the Error relocating... message above. It’s at least trying to transcode, but I don’t know what the “relocating” error message is trying to tell me.

FWIW, this is what I’m seeing in the path you had me add to the file in your last post:

brossow@NUC-UBUNTU:~$ ll /usr/lib/x86_64-linux-gnu/dri/
total 497216
drwxr-xr-x  2 root root     4096 Dec  2 10:51 ./
drwxr-xr-x 93 root root    77824 Dec  2 10:51 ../
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 crocus_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 d3d12_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 i915_dri.so
-rw-r--r--  4 root root 16624136 Dec  1 23:08 i965_dri.so
-rw-r--r--  1 root root  8098968 Feb  6  2020 i965_drv_video.so
-rw-r--r--  1 root root 36730632 Sep 13 12:42 iHD_drv_video.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 iris_dri.so
lrwxrwxrwx  1 root root       54 Dec  2 10:51 kms_swrast_dri.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/kms_swrast_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 kms_swrast_dri.so~
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 nouveau_dri.so
-rw-r--r--  3 root root 12963392 Dec  1 23:08 nouveau_drv_video.so
-rw-r--r--  4 root root 16624136 Dec  1 23:08 nouveau_vieux_dri.so
-rw-r--r--  4 root root 16624136 Dec  1 23:08 r200_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 r300_dri.so
lrwxrwxrwx  1 root root       48 Dec  2 10:51 r600_dri.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/r600_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 r600_dri.so~
lrwxrwxrwx  1 root root       54 Dec  2 10:51 r600_drv_video.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/r600_drv_video.so
-rw-r--r--  3 root root 12963392 Dec  1 23:08 r600_drv_video.so~
-rw-r--r--  4 root root 16624136 Dec  1 23:08 radeon_dri.so
lrwxrwxrwx  1 root root       52 Dec  2 10:51 radeonsi_dri.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/radeonsi_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 radeonsi_dri.so~
lrwxrwxrwx  1 root root       58 Dec  2 10:51 radeonsi_drv_video.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
-rw-r--r--  3 root root 12963392 Dec  1 23:08 radeonsi_drv_video.so~
lrwxrwxrwx  1 root root       50 Dec  2 10:51 swrast_dri.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/swrast_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 swrast_dri.so~
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 virtio_gpu_dri.so
lrwxrwxrwx  1 root root       50 Dec  2 10:51 vmwgfx_dri.so -> /opt/amdgpu/lib/x86_64-linux-gnu/dri/vmwgfx_dri.so
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 vmwgfx_dri.so~
-rw-r--r-- 13 root root 27602728 Dec  1 23:08 zink_dri.so

And this is what I’m seeing in the ‘dri’ directory within the PMS stuff:

brossow@NUC-UBUNTU:~$ ll /usr/lib/plexmediaserver/lib/dri/
total 55568
drwxr-xr-x 2 root root     4096 Dec  1 09:43 ./
drwxr-xr-x 3 root root    12288 Dec  1 09:43 ../
-rwxr-xr-x 1 root root  7820992 Nov 30 12:53 i965_drv_video.so*
-rwxr-xr-x 1 root root 36312136 Nov 30 12:53 iHD_drv_video.so*
-rw-r--r-- 1 root root 12745648 Dec  1 10:30 radeonsi_drv_video.so

As a wild guess, I made the last driver in the list above executable like the other two (chmod 755…) but it made no difference. I can’t help thinking I’m close and could get there if I could just figure out this last(?) piece of the puzzle.

Just now I found via Google a single other mention of this specific error in this Reddit thread. I don’t understand the replies, beginning with “Unfortunately the original instructions are no longer valid since Plex switched to musl as libc replacement…” but they might mean something to someone else.

OUCH. That’s a required but missing symbol / function in the SO file.

Are these current ? (maybe back up one version to be safe?)

It definitely looks like an AMD bug

They should be current. Honestly, I’ve tried so many different things over the past few weeks I can’t even remember how/where/when I got the drivers.

That said, I just spent the past hour or so fumbling my way through uninstalling and reinstalling all of the AMD drivers, libllvm12, etc. – or at least I think I did. I followed the instructions from AMD here to install the 21.40.1 version here released on November 3. (I believe I was previously using v21.30.) I’m still getting the same error.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.