Hardware transcoding not working in docker

Server Version#: 1.30.1.6497-5fc2e0894
Player Version#: Web Client

I am trying to set up Plex running in docker on my friend’s NUC. I am using lscr.io/linuxserver/plex:latest image and I am passing through the /dev/dri device. He had Plex installed on his Asustor NAS and I moved it to his NUC. Everything is working except hardware transcoding. He is a Plex Pass subscriber and he has hardware transcoding and hardware acceleration turned on.

I followed the steps listed here.

Here are the logs

ERROR - Unknown metadata type:
DEBUG - [Req#d3/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#d3/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#d3/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#d3/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#d3/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#dc/Transcode] TPU: hardware transcoding: using hardware decode accelerator vaapi
DEBUG - [Req#dc/Transcode] TPU: hardware transcoding: zero-copy support present
DEBUG - [Req#dc/Transcode] TPU: hardware transcoding: using zero-copy transcoding
DEBUG - [Req#dc/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#dc/Transcode] TPU: hardware transcoding: final decoder: vaapi, final encoder: vaapi
ERROR - [Req#e4/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f45611a35c0] missing picture in access unit with size 10
ERROR - [Req#e5/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f45611a35c0] no frame!
ERROR - [Req#ea/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f455f0024c0] no frame!
ERROR - [Req#f2/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] Error while decoding stream #0:0: Invalid data found when processing input
ERROR - [Req#f4/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264_vaapi @ 0x7f455f0fb600] Driver does not support any RC mode compatible with selected options (supported modes: CQP).
ERROR - [Req#f5/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
DEBUG - Streaming Resource: Changing client to use software decoding
DEBUG - TPU: hardware transcoding: enabled, but no hardware decode accelerator found
DEBUG - Codecs: hardware transcoding: testing API vaapi
DEBUG - TPU: hardware transcoding: final decoder: , final encoder:
ERROR - [Req#10d/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f5effd105c0] missing picture in access unit with size 10
ERROR - [Req#10e/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f5effd105c0] no frame!
ERROR - [Req#115/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] [h264 @ 0x7f5efdb744c0] no frame!
ERROR - [Req#116/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] Error while decoding stream #0:0: Invalid data found when processing input
DEBUG - [Req#117/Transcode/vxdzy32g58a4lf36uo9b3xbv/fd354b7b-9729-4c1c-9d24-d5529f655bf1] Transcoder: session vxdzy32g58a4lf36uo9b3xbv indicated fallback to software decoding
ERROR - Unknown metadata type:

Please help!

Which NUC? Specifically, which CPU and distro + version is this running on ?

You don’t need to hack stuff to make it work anymore.

PMS brings all the runtime libraries with it now.

Sorry @ChuckPa that info would be helpful wouldn’t it.

Intel(R) Celeron(R) N5095
Ubuntu 22.04.1 LTS

@Tortuga

Did you install Intel-Compute-Runtime on the host?

what does dpkg -l | grep gmmlib return?

Asking because we work perfectly with N5095 NAS CPUs

Nothing on my friend’s NUC

On my NUC where hardware transcoding works I see

intel-gmmlib  21.3.3  amd64  Intel(R) Graphics Memory Management Library Package

I installed all 7 packages here…

@ChuckPa

I tried doing apt-get install intel-gmmlib but got Unable to locate package intel-gmmlib

Sorry for the multiple posts

Uninstall all 7 packages please :rofl:
Then restart the host to complete unloading memory

PMS brings everything with it.

If you install those, they get injected ahead of PMS resulting in a loss of sync between what PMS knows and what the system has for support library versions.

Ok I uninstalled all 7 packages, reboot, played a video and saw this in the logs

DEBUG - [Req#132/Transcode] TPU: hardware transcoding: enabled, but no hardware decode accelerator found
DEBUG - [Req#132/Transcode] TPU: hardware transcoding: final decoder: , final encoder:
ERROR - [Req#13b/Transcode/rezo9f6g6p74ftkspabnljg4/8937a83d-cfc7-49cf-9952-401cd1da6357] [h264 @ 0x7f91d7e1c580] missing picture in access unit with size 10
ERROR - [Req#13c/Transcode/rezo9f6g6p74ftkspabnljg4/8937a83d-cfc7-49cf-9952-401cd1da6357] [h264 @ 0x7f91d7e1c580] no frame!

@ChuckPa

Sorry, I forgot to force transcoding. When I force transcoding I get this…

DEBUG - [Req#ec6/Transcode] TPU: hardware transcoding: enabled, but no hardware decode accelerator found
DEBUG - [Req#ec6/Transcode] TPU: hardware transcoding: final decoder: , final encoder:
ERROR - [Req#ece/Transcode/k7negxhn78fmzga93q7te1cf/0d326e6e-e796-4ca8-bd0a-953831d8ad5a] [h264 @ 0x7fd5d2c1a580] missing picture in access unit with size 10
ERROR - [Req#ecf/Transcode/k7negxhn78fmzga93q7te1cf/0d326e6e-e796-4ca8-bd0a-953831d8ad5a] [h264 @ 0x7fd5d2c1a580] no frame!
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fa6/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fbb/Transcode] TPU: hardware transcoding: using hardware decode accelerator vaapi
DEBUG - [Req#fbb/Transcode] TPU: hardware transcoding: zero-copy support present
DEBUG - [Req#fbb/Transcode] TPU: hardware transcoding: using zero-copy transcoding
DEBUG - [Req#fbb/Transcode] Codecs: hardware transcoding: testing API vaapi
DEBUG - [Req#fbb/Transcode] TPU: hardware transcoding: final decoder: vaapi, final encoder: vaapi
ERROR - [Req#fc7/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7f2b5a5265c0] missing picture in access unit with size 10
ERROR - [Req#fc8/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7f2b5a5265c0] no frame!
ERROR - [Req#fce/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7f2b583854c0] no frame!
ERROR - [Req#fdb/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] Error while decoding stream #0:0: Invalid data found when processing input
ERROR - [Req#fdd/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264_vaapi @ 0x7f2b5847e600] Driver does not support any RC mode compatible with selected options (supported modes: CQP).
ERROR - [Req#fde/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
DEBUG - Streaming Resource: Changing client to use software decoding
DEBUG - TPU: hardware transcoding: enabled, but no hardware decode accelerator found
DEBUG - Codecs: hardware transcoding: testing API vaapi
DEBUG - TPU: hardware transcoding: final decoder: , final encoder:
ERROR - [Req#1002/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7ff0e6c8e5c0] missing picture in access unit with size 10
ERROR - [Req#1003/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7ff0e6c8e5c0] no frame!
ERROR - [Req#1009/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] [h264 @ 0x7ff0e4af24c0] no frame!
ERROR - [Req#100a/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] Error while decoding stream #0:0: Invalid data found when processing input
DEBUG - [Req#100b/Transcode/grjcf6649ekjnx68wild1nk8/3d116c95-a611-4bf8-abf8-4304a8316141] Transcoder: session grjcf6649ekjnx68wild1nk8 indicated fallback to software decoding

OK… getting there.

From inside the container, look at /dev/dri

Specifically look at the GID which owns the files.

Is the UID:GID combo you’re using a member of the ‘group’ which owns

/dev/dri/card0 & /dev/dri/renderD128

?

On the host

crw-rw----+  1 root video  226,   0 Jan  5 15:20 card0
crw-rw----+  1 root render 226, 128 Jan  5 15:20 renderD128

In the container

crw-rw---- 1 root video     226,   0 Jan  5 20:21 card0
crw-rw---- 1 root videob2o2 226, 128 Jan  5 20:21 renderD128

But AFAIK the linuxserver docker image is supposed to set that up correctly. Logs from docker compose

plex  | **** permissions for /dev/dri/renderD128 are good ****
plex  | **** permissions for /dev/dri/card0 are good ****

I have a media:media user/group with PID/GID of 1003:1001 but oddly all of the files are owned by 911:911

PS. My NUC that works is set up the same way regarding permissions

When you’re using the native package, I go meddle with /etc/groups during installation . I add ‘plex’ to ‘render’ (or whichever group) owns /dev/dri

The same needs to happen so the container can piggyback the udev group permissions. This part is usually manual.

It’s a usermod -a -G operation.

I get what you are saying but I am not sure how to do that. I set PUID and GUID in the docker compose file to my media user but for some odd reason everything on my plex folder is owned by 911:911. All of my other linuxserver docker containers are set up the same way but media:media owns all of the files.

There is no user or group with id of 911 on my host. So I am not sure how to add a nonexistent user to the video or render groups.

And what’s also puzzling is that this works fine on my NUC and I see the same 911 user and the access is set up the same.

Here’s how we get truth from the host.

[chuck@lizum ~.2002]$ ls -lan /dev/dri
total 0
drwxr-xr-x   3 0   0      140 Dec 23 02:07 ./
drwxr-xr-x  21 0   0     5180 Jan  4 16:39 ../
drwxr-xr-x   2 0   0      120 Dec 23 02:07 by-path/
crw-rw----+  1 0 109 226,   0 Jan  1 18:36 card0
crw-rw----+  1 0 109 226,   1 Jan  5 08:57 card1
crw-rw----+  1 0 109 226, 128 Jan  1 18:36 renderD128
crw-rw----+  1 0 109 226, 129 Jan  1 18:36 renderD129
[chuck@lizum ~.2003]$ ls -la /dev/dri
total 0
drwxr-xr-x   3 root root        140 Dec 23 02:07 ./
drwxr-xr-x  21 root root       5180 Jan  4 16:39 ../
drwxr-xr-x   2 root root        120 Dec 23 02:07 by-path/
crw-rw----+  1 root render 226,   0 Jan  1 18:36 card0
crw-rw----+  1 root render 226,   1 Jan  5 08:57 card1
crw-rw----+  1 root render 226, 128 Jan  1 18:36 renderD128
crw-rw----+  1 root render 226, 129 Jan  1 18:36 renderD129
[chuck@lizum ~.2004]$

  1. PMS runs as it’s PID
  2. The GID assigned to the container is a member of (in this case) group 109 (render)

/etc/group will show you.

EDIT: What is this group? Manually assigned?? It’s clearly non-standard.

crw-rw---- 1 root videob2o2 226, 128 Jan  5 20:21 renderD128

Take a look at: docker-plex/run at master · linuxserver/docker-plex · GitHub

Looking at this script it appears that permissions are good. And this is how mine is set up and it works.

When I run ls -lan /dev/dri I get

drwxr-xr-x   3 0   0      100 Jan  5 15:20 .
drwxr-xr-x  20 0   0     4760 Jan  5 15:20 ..
drwxr-xr-x   2 0   0       80 Jan  5 15:20 by-path
crw-rw----+  1 0  44 226,   0 Jan  5 15:20 card0
crw-rw----+  1 0 109 226, 128 Jan  5 15:20 renderD128

And ls -la /dev/dri gives me:

drwxr-xr-x   3 root root        100 Jan  5 15:20 .
drwxr-xr-x  20 root root       4760 Jan  5 15:20 ..
drwxr-xr-x   2 root root         80 Jan  5 15:20 by-path
crw-rw----+  1 root video  226,   0 Jan  5 15:20 card0
crw-rw----+  1 root render 226, 128 Jan  5 15:20 renderD128

If I do ll /opt/appdata/plex/Library/Application\ Support/Plex\ Media\ Server/ I get:

drwxrwxr-x 13  911  911  4096 Jan  5 15:22  ./
drwxrwxr-x  3  911  911  4096 Jan  3 16:04  ../
drwxrwxr-x  8  911  911  4096 Jan  6 10:31  Cache/
drwxrwxr-x  5  911  911  4096 Jan  4 10:55  Codecs/
drwxrwxr-x 35  911  911  4096 Jan  5 15:21 'Crash Reports'/
drwxrwxr-x  2  911  911  4096 Jul  2  2020  Diagnostics/
drwxrwxr-x  3  911  911  4096 Dec 30 00:00  Drivers/
-rw-------  1  911  911    42 Jan  5 15:21  .LocalAdminToken
drwxrwxr-x  3  911  911  4096 Jan  6 04:43  Logs/
drwxrwxr-x  3  911  911  4096 Jun 30  2020  Media/
drwxrwxr-x  6  911  911  4096 Jan  4 11:03  Metadata/
-rw-r--r--  1  911  911     3 Jan  5 15:21  plexmediaserver.pid
drwxrwxr-x  3  911  911  4096 Jun 29  2020  Plug-ins/
drwxrwxr-x  7  911  911  4096 Jun 29  2020 'Plug-in Support'/
-rw-------  1 root root  1233 Jan  3 18:09  Preferences.bak
-rw-------  1  911  911  1155 Jan  3 18:21  Preferences.bak2
-rw-------  1  911  911   987 Jan  5 15:22  Preferences.xml
-rw-------  1  911  911 12330 Jan  5 15:21 'Setup Plex.html'
drwxrwxr-x  2  911  911  4096 Dec 30 00:00  Updates/

So if it’s a permissions issue on the card and render devices, then how do I add UID 911 to the video or render group as there is no user on my system with id of 911?

Could I chmod the /dev/dri to 777 to rule out a permissions issue?

Edit: See GitHub - linuxserver/docker-plex

@ChuckPa

  1. You can chmod the permissions of /dev/dri as a test. They will reset at restart

  2. How did you get UID/GID 911 in the first place ??? Did you copy from someone else without (perhaps) realizing the impact downstream ?

Do you have PMS installed natively on the host ?

The functional difference (HDR tonemapping) is no longer a factor. (Built into PMS)

I switched from the linuxserver image to plexinc/pms-docker:latest. I updated the docker compose to ensure the user/groups are correct.

On host

groups media
media : media video render

In container

ls -l /dev/dri
total 0
crw-rw---- 1 root video  226,   0 Jan  6 14:51 card0
crw-rw---- 1 root video1 226, 128 Jan  6 14:51 renderD128

Still the same errors. Then I chmod in the container to get this

ls -l /dev/dri
total 0
crwxrwxrwx 1 root video  226,   0 Jan  6 14:51 card0
crwxrwxrwx 1 root video1 226, 128 Jan  6 14:51 renderD128

And it still reverts to software transcoding.

Here are my docker compose logs…

plex  | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
plex  | [s6-init] ensuring user provided files have correct perms...exited 0.
plex  | [fix-attrs.d] applying ownership & permissions fixes...
plex  | [fix-attrs.d] done.
plex  | [cont-init.d] executing container initialization scripts...
plex  |[cont-init.d] 40-plex-first-run: executing...
plex  | Plex Media Server first run setup complete
plex  | [cont-init.d] 40-plex-first-run: exited 0.
plex  |[cont-init.d] 45-plex-hw-transcode-and-connected-tuner: executing...
plex  | [cont-init.d] 45-plex-hw-transcode-and-connected-tuner: exited 0.
plex  |[cont-init.d] 50-plex-update: executing...
plex  | [cont-init.d] 50-plex-update: exited 0.
plex  | [cont-init.d] done.
plex  | [services.d] starting services
plex  | Starting Plex Media Server.
plex  | [services.d] done.
plex  | Critical: libusb_init failed

I do not have PMS installed on the host.

And the 911 user/groups were because I had the wrong environment variables for the linuxserver image. I have resolved that.

@ChuckPa

I don’t worry about lsbinit failing. We’re not using a USB tuner here.

Which version PMS do you have natively on the host?
Version 1.29.2 has every capability the docker image (natively) without the current TrueHD / EAE issues.

I’ll provide you with the DEB file if you need it for 1.29.2

Looking at my test logs and comparison data.

N5105 and N5095 are both JasperLake
N5105 has 8 more EUs