Enable iGPU in Emby Docker

What version of plexguide?

PG 8.7.5

What Operating System?

Ubuntu 18.04

What is the problem?

There used to be a few threads talking about this on the old forum so I was hoping someone still had the notes to accomplish this. I’m looking for the config changes that would allow the pass-through of the iGPU to the Emby docker container to allow it to use it for transcoding.

Hetzner server ?

No, I’m on a SoYouStart server.

Have you enabled iGPU to the server itself? (that would be best first step before trying to get it working on the container)

I have not. Could you throw a keyword or two that I might search for to help me down this path? Is there a process or driver that is needed to be added to the server OS (ubuntu 18.04) first to enable the iGPU?

I know you said you are not on hetzner, but https://community.hetzner.com/tutorials/howto-enable-igpu was pretty helpful to test/check & give an idea of what to look for

1 Like

Thanks for that link. I followed along through that and it looks like the iGPU is already enabled. Running the following

ls -la /dev/dri

gave me the following output

drwxr-xr-x  3 root root       120 Jan 31 22:48 .
drwxr-xr-x 19 root root      4280 Jan 31 22:48 ..
drwxr-xr-x  2 root root       100 Jan 31 22:48 by-path
crw-rw----  1 root video 226,   0 Jan 31 22:48 card0
crw-rw----  1 root video 226,   1 Jan 31 22:48 card1
crw-rw----  1 root video 226, 128 Jan 31 22:48 renderD128

Which matches up with the expected results from the article. Thinking that I now just need to get this passed into the docker container for Emby?

The /dev/dri must be added under devices
And the docker needs a redeploy over portainer or apps section

So poking around at the emby.yml in the coreapps I see this line which I believe is doing a check for the device and if it finds it should be setting that into the container on creation?

devices: "{{ '/dev/dri:/dev/dri' if dev_dri.stat.exists == True | default(false) else omit }}"

I haven’t figured out what it does to set a value for dev_dri_stat.

Can I just set a device up by editing the container in portainer just to test if it works?

Ya you can add this devices over portainer self
If you want
But the docker needs a redeploy over portainer

duplicate/edit > devices >

Host: /dev/dri
Container: /dev/dri

Deploy the Container

That’s all

Interesting… the driver was being dedicated and setup with the container already I just didn’t know where to find those in Portainer until you pointed me there.

Now to figure out why Emby doesn’t seem to be seeing it or using it. I’m basing this off of the CPU usage I see in netdata when I force a transcode spiking.

VAAPI

Note: This applies to amd64 only.

Emby now comes with a VAAPI-enabled ffmpeg out of the box on Intel platforms with HD graphics. For VAAPI to work, emby needs access to a render node, usually /dev/dri/renderD128 . On most modern distros, this render node belongs to the video group, others belong to the render group. All you need to do is mount the render node and add the video group GID to the GIDLIST variable as described above.

You can get the video and/or render GIDs using the following command:

getent group video | cut -d: -f3
getent group render | cut -d: -f3
    --env GIDLIST=100 \ # A comma-separated list of additional GIDs to run emby as (default: 2)

Please adapt the UID, GID and GIDLIST values to match the owner of your media files. GIDLIST is also needed to grant access to VAAPI/NVDEC/NVENC render nodes.


Source 

https://hub.docker.com/r/emby/embyserver#unraid-installation

OK, mine is part of the video group and I’ve found the GID for that. I’ll add that GID to the GIDLIST in portainer.

To mount the render node is that just adding another Device to the container?

Host: /dev/dri/renderD128
Container: /dev/dri/renderD128

Replace the

Host: /dev/dri
Container: /dev/dri

With

Host: /dev/dri/renderD128
Container: /dev/dri/renderD128

doobs! You’re the man! Thanks so much that final change got me up and running. I’m going to write this up and I’ll post it as an edit to my original to help anybody else. Thanks so much for all your help.

2 Likes

https://raw.githubusercontent.com/doob187/Apps-Core/v8.6/apps/emby.yml

I have edited the yml for emby now :wink: