Hardware Transcoding using Unraid Docker?

Is there any way to turn on hardware transcoding in the docker image for unraid?

Thanks in advance…

I’ve been meaning to reinstall unraid to see what the deal is, but haven’t had a chance yet.

What version of unraid are you running?

Can you ssh in and run this command, and copy/paste the results back:

ls -alh /dev/dri

Running version 6.3.5 of UnRaid.

The dri directory doesn’t exist under /dev in my docker image. Tons of other folders, but not dri

I used docker exec to connect into the docker image and look.

What about outside the container

Not seeing that directory outside either. But I need to get more familiar with the way Unraid handles the passthrough of the physical Graphics card to docker containers. I know you have to do several things to make it work on VMs. I am sure there are similar hoops to make it work for docker as well.

If I find out anything, I will let you know!

Did you follow the guide:
https://community.getchannels.com/dvr#install-docker

Because /dev/dri is only available if you map the device to your docker container. It is not standard available in the docker image, you must use the one from your host.

Passing the graphics device into docker is easy. The problem is that it doesn’t exist in the first place outside the container. Without /dev/dri/renderD128 it’s not possible to do hardware transcoding.

Can you check if the Intel driver is installed on the host?

lsmod | grep i915
modprobe i915
lsmod | grep i915
ls -alh /dev/dri

Uploading screenshot of my terminal after running the commands. I bet my onboard graphics card is disabled in the BIOS. I will check this out when I get home.

I am assuming there is no way to passthrough the Nvidia card instead?

Thanks again for all you guys do!! Channels is by far the best app I have ever come across!

We currently only support NVIDIA based hardware acceleration on Windows.

It’s weird that the i915 driver is loaded but the /dev/dri device doesn’t exist. FWIW, I’ve heard the same reported from other unraid users too. This works automatically on every other Linux system I’ve worked with so I’m not sure what else is required.

In this thread several unraid users are saying /dev/dri exists for them and they got hw transcoding working with Plex/Emby: https://forums.lime-technology.com/topic/53388-enabling-i915-for-host/?do=findComment&comment=597550

1 Like

No worries! It is not that big a deal. I really like the Unraid docker. I know you just updated it to fix the commercial detection. Thanks a bunch!

I’m glad that I found this post. The instructions linked to at the Unraid forum worked perfectly - I now have hardware transcoding working in both Channels and Plex using Unraid/Docker.

2 Likes

I'm giving UnRaid a try (and having much better luck)….

I followed the above directions in this thread, and put this in, in the terminal....

lsmod | grep i915
modprobe i915
lsmod | grep i915
ls -alh /dev/dri

This is what I have for my output:

root@Tower:~# ls -alh /dev/dri
total 0
drwxr-xr-x 3 root root 100 Feb 13 07:27 ./
drwxr-xr-x 15 root root 3.6K Feb 13 07:27 ../
drwxr-xr-x 2 root root 80 Feb 13 07:27 by-path/
crw-rw---- 1 root video 226, 0 Feb 13 07:27 card0
crw-rw---- 1 root video 226, 128 Feb 13 07:27 renderD128

Then in UnRaid, I went into Docker > ChannelsDVR > Advanced View > then put in the following under "Extra Parameters:

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

Is this all I need? Should hardware transcoding be enabled? How can I verify that this is in fact enabled?

root@Tower:~# ls -alh /dev/dri
/bin/ls: cannot access '/dev/dri': No such file or directory
root@Tower:~# lsmod | grep i915
root@Tower:~# modprobe i915
root@Tower:~# lsmod | grep i915
i915 1245184 1
video 40960 1 i915
i2c_algo_bit 16384 1 i915
iosf_mbi 16384 1 i915
drm_kms_helper 126976 1 i915
drm 319488 3 drm_kms_helper,i915
intel_gtt 20480 1 i915
backlight 16384 2 video,i915
i2c_core 40960 5 drm_kms_helper,i2c_algo_bit,i2c_i801,i915,drm
root@Tower:~# ls -alh /dev/dri
total 0
drwxr-xr-x 3 root root 100 Feb 13 08:05 ./
drwxr-xr-x 15 root root 3.6K Feb 13 08:05 ../
drwxr-xr-x 2 root root 80 Feb 13 08:05 by-path/
crw-rw---- 1 root video 226, 0 Feb 13 08:05 card0
crw-rw---- 1 root video 226, 128 Feb 13 08:05 renderD128

Am I good to go?????

One more question.....how do I retain these settings changes for when I reboot? I am noticing that this configuration change does not stick when I reboot.

Thanks again for all your help

So I did the following, and it seems to work....

On my Unraid flash drive, I opened up my "go" file with NotePad (it's in the Config folder), and put in the following:

#Setup drivers for hardware transcoding in Plex
modprobe i915
chown -R nobody:users /dev/dri
chmod -R 777 /dev/dri

#Copy SSH files back to /root/.ssh folder and set permissions for files
mkdir -p /root/.ssh
cp /boot/config/ssh/medianas_key /root/.ssh/id_rsa
cp /boot/config/ssh/known_hosts /root/.ssh/known_hosts
cat /boot/config/ssh/backupnas_key.pub > /root/.ssh/authorized_keys
chmod g-rwx,o-rwx -R /root/.ssh

#!/bin/bash
#Start the Management Utility
/usr/local/sbin/emhttp &

Then in Unraid web GUI, I went into Docker > ChannelsDVR > Advanced View > "Add another Path, Port, Variable, Label or Device", and put in the following:

Config Type: Device
Name: Video
Value: /dev/dri:/dev/dri
Description: Container Device:/dev/dri

Display: Always
Required: No
Password Mask: No

Now upon booting up, the iGPU appears to be activated (MUCH sharper text on the terminal screen on a local monitor), and it lists the following in my CLI output....

root@Tower:~# ls -alh /dev/dri
total 0
drwxrwxrwx 3 nobody users 100 Feb 13 10:12 ./
drwxr-xr-x 15 root root 3.6K Feb 13 10:13 ../
drwxrwxrwx 2 nobody users 80 Feb 13 10:12 by-path/
crw-rw---- 1 root video 226, 0 Feb 13 10:12 card0
crwxrwxrwx 1 nobody users 226, 128 Feb 13 10:12 renderD128

I followed this forum, which involves getting hardware transcoding to work on Plex...

Your thoughts?

1 Like

I'm doing something similar, but I'm using systemd-nspawn and machinectl to manage containers for my local server apps. In my .nspawn files (ie, plex.nspawn, channels.nspawn) I have this:

[Exec]
PrivateUsers=false
 
[Service]
DeviceAllow=char-drm rwm
 
[Files]
Bind=/dev/dri

The PrivateUsers=false is necessary to preserve the permissions on /dev/dri, because if PrivateUsers are used with bind mounts, then all bind mounts are given the nobody user and group. The DeviceAllow options gives read, write, and mknod capabilities to the containers for DRM subsystem devices.

While it is best to use Private Users and namespacing for containers, systemd-nspawn does not allow GPU to containers when using namespacing. (However, I have discovered that LXC containers can pass through the needed /dev/dri devices and use namespacing. But, I personally wanted to stick with systemd for the majority of this particular server.)

1 Like

Yeah, you just went WAY over my head man. No idea what any of that is. I'm not too concerned about security, as I am STRICTLY creating this box JUST for ChannelsDVR. I just need to make sure what I have will work.

What you have looks fine to me. Does the DVR show hardware transcoding option?

By DVR, do you mean UNRAID or Channels? I don't see a transcode option anywhere in the ChannelsDVR Docker.

On the Channels setup page, I can't determine that as of yet, as the Channels setup page does not let me proceed without an HDHOMERUN tuner on my network (of which there is not, where the box currently sits).

I need to run through the initial setup wizard for Channels again, on this box. Is there a way I can reset the settings? I am on "step 3".

It sounds like you're in the setup wizard already. Until you find and setup an HDHR, it won't show you the transcoding options.

You can try opening http://x.x.x.x:8089/system/misc and see what it says for transcoder