Activating Plex hardware acceleration on TrueNAS 12 Core

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
I think it's time we PR'ed the required changes to enable hardware transcoding on the stock plugin and be done with these threads.

I am feeling ambivalent about that, because of issues like https://forums.plex.tv/t/pgs-and-vobsub-burn-in-fails-with-hw-transcode-freebsd-12-1/612429/3 . Arguably subtitle burn-in is one of the few legitimate use cases for transcode, and it's working fine on Linux but not FreeBSD 12.1.

For my personal use, I will likely stop worrying about hw transcode on FreeBSD, it's a game of whack-a-mole with Plex versions and FreeBSD versions, and not as much of a priority as Linux to Plex. When ACLs are in and the migration wizard (December?), I may move my home setup to TrueNAS SCALE.
 

emsicz

Explorer
Joined
Aug 12, 2021
Messages
78
How many 4K streams can be simultaneously transcoded to 1080p over 1gbps network on TrueNAS/Plex setup with iGPU? It seems totally nuts to me to run Plex on TrueNAS.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Transcoding 4k HDR to 1080p is not a good experience, because hdr to sdr tone mapping is terrible. You’re much better off just keeping a native 1080p SDR file alongside.

Plex on TrueNAS works great for my use case, which is media-shifting my owned library from physical to digital.
 

CGCGuy

Cadet
Joined
Sep 21, 2021
Messages
1
I have TrueNas lastest version.. and I have a i7-10700F CPU. What is the cheapest way to get hardware acceleration on this build? Is there a GPU I can add or would the best way be to switch the motherboard for an AMD Ryzen 7 3700x and motherboard?
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Cheapest ways to get hardware transcode acceleration on Intel 10th gen:
- move to TrueNAS Scale once that’s stable enough for your comfort
- or wait until FreeBSD supports it, and hope it actually works in Plex as well

neither NVidia nor AMD will help you in core. NVidia at least should work in scale, but so does Intel.
 

Etorix

Wizard
Joined
Dec 30, 2020
Messages
2,134
i7-10700F = no iGPU = no hardware acceleration
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
well spotted. In that case: Scale and NVidia card.
 

emsicz

Explorer
Joined
Aug 12, 2021
Messages
78
I find the experience with Plex absolutely terrible on TrueNAS, but I use it for everything else. I ended up building separate tower just for Plex.
 

TheSir

Dabbler
Joined
Nov 13, 2021
Messages
22
I want to join this conversation, because i have a question regarding the necessairy steps.
I hope its ok to push this thread up a bit...

I did the following steps:
  1. Load the drm kernel module: create tunable: Type: loader, Variable: drm_load, Value: YES.
  2. Load the i915kms kernel module: create tunable: Type: loader, Variable: i915kms_load, Value: YES.
  3. Install the support libs in the plex jail: pkg install multimedia/libva-intel-driver multimedia/libva-intel-media-driver
  4. Add plex to the video group: pw groupmod -n video -m plex
  5. Setup a custom devfs rule set for the plex jail. and did a chmod -x plex.sh
Two questions:

I have plex_drm=4 not 109, because with 109 my jail wont start. Did i understand correctly that the plex_drm number needs only to be the same in the jail and in the script? Or is the 109 absolutely neccessairy to geht hw decoding to work? For now, i simply modified the script to plex_drm=4.

Whats not mentioned on the first page is that the .sh script needs chmod +x to work. ;) Now i have the /dev/dri and /dev/drm/ folders with content. But hw acc does still not work. Do i really need to install truenas with UEFI instead of classic BIOS? Is that the cause?

My understanding is, that the main problem is FreeBSD and these hw decoding prpblems were gone with TrueNAS scale because its deban based , right?
 

dak180

Patron
Joined
Nov 22, 2017
Messages
310
I have plex_drm=4 not 109, because with 109 my jail wont start. Did i understand correctly that the plex_drm number needs only to be the same in the jail and in the script? Or is the 109 absolutely neccessairy to geht hw decoding to work? For now, i simply modified the script to plex_drm=4.
109 was chosen because each rule needs to have a unique number and not only are 1-7, among others, already in use but by default iocage generates devfs rule sets dynamically for jails at start time. I am not sure that the GUI correctly overrides this behavior; you may need to set it via command line instead: iocage set devfs_ruleset="109" "<jail name>".
 

TheSir

Dabbler
Joined
Nov 13, 2021
Messages
22
109 was chosen because each rule needs to have a unique number and not only are 1-7, among others, already in use but by default iocage generates devfs rule sets dynamically for jails at start time. I am not sure that the GUI correctly overrides this behavior; you may need to set it via command line instead: iocage set devfs_ruleset="109" "<jail name>".
I dont know why, but it seems that my jails are only start with ruleset=4...
It results in Starting plex plex devfs_ruleset 109 does not exist! - Not starting jail

So the script you posted will not work if i set the set devfs_ruleset from "109" to "4"?
I did a new install, now with UEFI Boot and restored the previous TrueNAS config, but HW acc still not working (i own plex pass)

Meh, its really frustrating all over. So maybe i will wait until TrueNAS scale will be stable and did a complete new installation.
 

tom9933

Dabbler
Joined
Nov 20, 2021
Messages
13
I'm in the process of building out a new TrueNAS sever (current I7 with lots of ram and drives) and interestingly enough I initially tested with scale on my 6th gen NUC. Transcoding worked out of the box with the stock plugin-in until I tried it with an 11th gen NUC. I found for that NUC I needed a better version of plex and I found it difficult to get the stock application to take the update. So now I'm testing with core as it sounded like scale wasn't quite ready yet but this may cause me to go back to scale... Question, on scale should the app automatically update or should I be building a custom app to get current (non-beta) versions? With windows its much easier but part of the reason I built the server out so beastly was to move away from windows for the 24x7 apps like plex and channels.
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Look at TrueCharts, it might do everything you want for Plex
 

tom9933

Dabbler
Joined
Nov 20, 2021
Messages
13

brombe

Cadet
Joined
Jan 9, 2022
Messages
1
Hello,
i tried to enabling hardware acceleration on my Plex Media Server following this guide, the original thread here, and this guide.
I'm on TrueNAS-12.0-U7, with an i5-4590 (it does support Intel Quick Sync), after the script the directories /dev/dri and /dev/drm are visible in both host and plex iocage and the user plex is in the video group. I have plex_drm=109 and jail devfs_rules set on 109.
But when i need to transcode a stream the video keep buffering then the player sends an error.
In the Plex console i got this:
[Transcode] Denying access due to session lacking permission to transcode key /library/metadata/15606
I tried some basic troubleshooting but i dont understand why if i run iocage get devfs_ruleset NasPlex with the jail stopped i get 109, but if i run the same command with the jain running i get 1001.
Can someone please help me?
Thanks.
 

Rubisrik

Cadet
Joined
Jan 26, 2022
Messages
2
Note: Plex requires FreeBSD 12 in the base system and jail for hardware acceleration, also this only covers intel gpus as that is all that is supported on FreeBSD.

Keep in mind this requires hardware support; you will need to have at a minimum: an intel cpu with an igpu, a motherboard that supports an igpu and additionally this may require specific settings in the bios and/or TrueNAS configured for UEFI booting.

If either ls /dev/dri or ls /dev/drm run on the base system and result in nothing, you have not met the hardware requirements and will need to make changes there or in the bios in order to be able to proceed.


  1. Load the drm kernel module: create tunable: Type: loader, Variable: drm_load, Value: YES.
  2. Load the i915kms kernel module: create tunable: Type: loader, Variable: i915kms_load, Value: YES.
  3. Install the support libs in the plex jail: pkg install multimedia/libva-intel-driver multimedia/libva-intel-media-driver
  4. Add plex to the video group: pw groupmod -n video -m plex
  5. Setup a custom devfs rule set for the plex jail:

Save the following script somewhere on the base system:
Code:
#!/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


service devfs restart


Set this to run as a postinit task. We do this rather than editing /etc/devfs.rules directly because it is regenerated on boot.

Finally you will need to edit the plex jail properties to set the devfs_ruleset to 109.

With this hardware acceleration should start working once TrueNAS is rebooted.

New with TrueNas and I find half super easy and half super hard to use.
I tried to follow your instruction and I stumble at step 1.
This is chinese.
Where is the turntable?
 

elorimer

Contributor
Joined
Aug 26, 2019
Messages
194
So this is a surprise. In my install I could never get hardware acceleration to work. I took advantage of a recent sale on 14tb drives to completely rebuild my storage, That required me to rebuild my plex, which was a little more complicated than I thought. After I did that, the hardware acceleration on my Gemini Lake seems to be working.

EDIT: Just to be a little more specific, the FreeBSD drivers for Gemini Lake have always had significant blockage issues, and the result was unwatchable. I last checked a year or so ago and gave up. In reinstalling Plex I needed to start over. When I ran dan35's script, I ran into the hole about 12.2 jails posted elsewhere. After I fixed that, I thought I would repeat the steps earlier in post #29. Step #3 ( installing the drivers) installed a ton of stuff. The other steps were intact. So I think somewhere in the updated drivers Gemini Lake issues were fixed.
 
Last edited:
Top