How to use Plex hardware transcoding on TrueNAS

Here is how you activate Plex hardware transcoding on your TrueNAS box to offload your CPU and get those Plex videos to play butter smooth!

While researching this I ran across this forum thread about activating hardware transcoding on Plex. However I could not get the tuneable to load the kernel modules to work. It works just as well though to load it through the script so just modify the script in the thread to look like this:

#!/bin/sh

cat >>/etc/devfs.rules << 'EOF'
[devfsrules_bpfjail=101]
add path 'bpf*' unhide

[plex_drm=109]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add include $devfsrules_bpfjail
add path 'dri*' unhide
add path 'dri/*' unhide
add path 'drm*' unhide
add path 'drm/*' unhide
EOF

kldload /boot/modules/i915kms.ko

service devfs restart

Add this script to for instance /root/scripts/plex.sh. Now go to Tasks -> Init/Shutdown scripts in TrueNAS and click Add. Use the following parameters:

  • Type: script
  • Path: /root/scripts/plex.sh
  • When: post init

Now go to Jails in TrueNAS and edit the Plex jail. Go to Jail Properties and change the devfs_ruleset to the same number as you set the plex_drm ruleset to, 109 in this case.

Now reboot your TrueNAS box. When it has booted up again and the Plex jail is running you can try to play something that needs transcoding, in the Plex dashboard you should see something like this.

Notice the (hw) next to Transcode, that indicates that Plex now is using hardware transcoding.

At time of writing I was running a 6700K and TrueNAS 12.0 so if you are using another configuration and run in to issues please comment below.

Sources:

5 Replies to “How to use Plex hardware transcoding on TrueNAS”

  1. Hey I have done everything as follows and the script is working fine I think. I have checked /etc/devfs.rules and all the info in the script is there. However when I launch a video and force convert the video I can see that it does not have the “(hw)” in transcode and the CPU spikes to 100%

    Any idea on what is happening and why its not working?

    1. Have you enabled hardware acceleration in the Plex server settings under: Settings -> Transcoder -> User hardware… ?

      Which TrueNAS version are you on? I wrote this for 12, things might have changed in 13. I’m also still on 12 so haven’t been able to test with 13.

  2. How do we find out plex_drm=109 value. When I set to this number to devfs_ruleset in jail properties and restarted the machine. My plex plugin not able to start.

    1. It’s just something you make up, you create the ruleset by running the script and then you connect the jail to this newly created rule set by editing the jail config. After running the script can you see the rule set being added to /etc/devfs.rules? If it’s not there then it should explain why it isn’t working for you. You need to add the script as an init script in TrueNAS so that it runs on boot otherwise the rule set won’t be created.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.