Jump to content

***GUIDE*** Plex Hardware Acceleration using Intel Quick Sync


Recommended Posts

Hell Unraid community. I've had my setup for a few years now and am finally configuring my rig (or trying) to enable hardware transcoding (not just for Plex but for other apps like Photoprism as well), but I'm not getting anywhere so I'm asking for help.

 

The problem I'm having is in /dev/dri/ I only see by-path/ and card0 nothing else. I also checked my bios and only have an 'onboard' or off board option, so I have 'onboard' selected. Not sure if this is the right choice since the mobo does have Matrox onboard graphics, but not sure if off board would work (there's also a jumper for vga on the motherboard that is set to on). If anybody had an idea, I'm all ears.

 

Here are my diagnostics zuse-diagnostics-20240212-2148.zip, but in short my CPU is a Quick Sync supported Xeon E31260L 2.40GHz installed on a Supermicro X9SCM-F motherboard 

 

The supermicro has the latest bios (2.3a) and my Unraid is on 6.12.6. I also have intel-gpu-top and I blacklisted i915 via

echo "blacklist i915" > /boot/config/modprobe.d/i915.conf 

and rebooted.

 

Again I'm all ears for idea, thanks in advance!

Link to comment
  • 1 month later...

Hi there -- I have a Beelink SEi12 with an i5 12450H in it.  I installed the Plex-Media-Server container and moved my plex data over from my Synology.  So far, so good. What isn't good is that nothing I do will make the container use the iGPU.  It is always using the CPU to transcode. I have a plex pass.  I am passing /dev/dri as a device.  Nothing.  I am at wits end and about to abandon this unraid adventure as it shouldn't take a day to make something work.  I could use some advice/help on what I can look at. If I can't solve it this weekend, I'm going to just buy a bigger synology and move on with my life.

Link to comment
59 minutes ago, rickeames said:

I am at wits end and about to abandon this unraid adventure as it shouldn't take a day to make something work

You make the assumption this has something to do with Unraid.  The only thing Unraid has to do with Plex transcoding is loading the i915 drivers.

 

On some motherboard BIOS (I am not familiar with yours), the primary graphics adapter must be set to the iGPU.  If set to Auto, the i915 drivers will not load.

 

Every once in a while Plex breaks transcoding.  I just tested it with Unraid 6.12.9 and Plex and transcoding is working properly for me.

 

- It is unclear exactly which Plex docker container you have installed.  There are several in Apps.  Which one are you using?

 

I assume much of this is setup correctly or you would not get CPU transcoding.

 

- Have you verified that i915 drivers are active and that /dev/dri is being created with the proper contents?  Should look similar to image below (don't worry if card1 is missing). Passing /dev/dri as a device does nothing if no /dev/dri and its contents exist. 

image.png.a1c1cc275cf886dd38e82a611f1f4fb4.png

 

- What does your docker run command look like?  Any errors?

 

- Have you set up a transcode path in Plex docker config and are you using it in Plex configuration? Mine looks like this as I am transcoding in RAM

 

image.png.8ed0f48b35157d6fadad025dbfb8600a.png

 

In Plex config:

image.png.c4d7ab135cb20fd0a3148a7a090d7a3d.png

 

if all of this is setup properly, Plex should hardware (iGPU) transcode media that is not in a format that can direct play in the client.

 

 

Edited by Hoopster
Link to comment

Thank you for responding. Here is my /dev/dri directory:

 

image.png.1d244f7238a157b3d2daf2d3cb5b0888.png

 

I have tried both binhex-plexpass and Plex-Media-Server (official). Here is my setting for transcodes:

 

image.thumb.png.5bdc9518e2ba1ef9051236767e9ffd95.png

 

image.thumb.png.7054da627806775105c01d1f4a6b43ba.png

 

All of this set, and when I play a file and downgrade it on purpose to transcode:

 

image.png.96da69f57c99725c247f776cb4dc82a8.png

 

Are there logs somewhere that would show me errors or what could possibly be going wrong?  Everyone else seems to think this is solved by just doing --device='/dev/dri' yet that hasn't done anything for me.  

 

Again, thank you for the help.

 

Link to comment

FWIW, I can get tdarr to use the iGPU, also via docker, by putting "device='/dev/dri'" just fine.  It's plex, which is making me start to wonder if somehow my "plex pass" isn't granting the container the rights to use the hardware encoding. Not sure how to debug that.  I moved my Plex folder over from my old install.  Plex is supposed to look for your plex pass and grant the container permission...but how do you check it?

Link to comment
12 hours ago, rickeames said:

Everyone else seems to think this is solved by just doing --device='/dev/dri' yet that hasn't done anything for me.  

How are you passing /dev/dri to Plex container?  It appears from what you are saying that /dev/dri exists but is not being used by your Plex docker container.

 

Are you putting ---device /dev/dri:/dev/dri in the Extra Parameters line of the container config? (may depend on Plex container you are using)

image.thumb.png.fc330222cc0f76126b4c5f503ceb5d5a.png

 

Or are you adding it as a device like this?

image.png.d7290dfb575350a5501db90f46a0aa4c.png

 

I have used both methods but I am currently using the second (device configuration) method.

 

I am using the Linuxserver version of the Plex docker so, perhaps whatever you are using may have slightly different configuration options.

 

Do you see these checkboxes in the Plex Transcoder configuration? if you see these and can select them, that usually means you have an active Plex Pass.

image.thumb.png.1f1d5c1c48c644e812a3aca6985962c4.png

 

Link to comment

Hi all. I've read through most of this thread, but I'm still having trouble. I'm running the binhex-plex image of Plex 1.40.1.8227 on Unraid 6.12.9 running on Topton motherboard with Intel N5105. I have the INTEL-GPU-TOP and GPU Statistics plugins installed.

 

The Unraid OS portion of my /boot/syslinux/syslinux.cfg file:
 

label Unraid OS
  menu default
  kernel /bzimage
  append i915.enable_fbc=1 i915.enable_guc=2
  append initrd=/bzroot

 

The contents of my /boot/config/modprobe.d/i915.conf file:
 

options i915 enable_fbc=1 enable_guc=2

 

After adding those, as specified in a previous post, I rebooted my server and I then had the /dev/dri directory. I added the device to my Plex config and when I loaded Plex, I was able to select my Jasper Lake GPU as the transcoder. I thought everything was going great until I found that media is buffering a lot whenever I have "Use hardware-accelerated video encoding" checked.

 

- Without that box checked, media plays without issue, but is heavy on my CPU. Running intel-gpu-top shows that the "Video" engine is working heavily, but no other engines are active. Dashboard shows that hardware transcoding is only taking place on decoding.

- With it checked, the CPU utilization goes down significantly, but I get a lot of buffering. Running intel-gpu-top shows that the "Video" and "VideoEnhance" engines are both active. Dashboard shows that hardware transcoding is taking place on both decoding and encoding

 

Subtitle burn-in isn't an issue, as I've confirmed the same behavior when subtitles are used with external SRT and when they're off completely. 

 

I'm not sure what other info to provide. Any help would be much appreciated. Thanks!

Link to comment

Yeah, I am seeing those...after a lot of dinking around last night, I finally saw this in the plex logs whenever I try to force a transcode.  I am certain, at this point, that something inside the container is having issues getting to the drivers properly. I am, once again, going to try a fresh transfer and see what the problem is.  Tdarr finds the iGPU just fine, so the problem isn't in unraid, it's in the plex container.  

 

 

[Req#6a7/Transcode] [FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error)

Req#6a7/Transcode] [FFMPEG] - libva: /config/Library/Application Support/Plex Media Server/Cache/va-dri-linux-x86_64/i965_drv_video.so init failed

 

When I cleared the cache and rebooted the container, I just get the "Failed to initialise VAAPI..." message.  

 

I suspect when I copied over my Plex Media Server folder, as they instruct you to do on the plex site when moving between machines, something messed up the install.  As I tried the same folder with both binhex and the "official" container, that has to the be issue.  I just wanted to preserve my playlists and "watched/unwatched." 

 

Update: tonight I started over and rescanned everything instead of moving the Plex folder from my old install.  That solved the problem.  I followed the plex directions entirely and it completely didn't work.  Weird. Thanks for the help everyone...live and learn every single day with this.

 

Edited by rickeames
Link to comment
  • 4 weeks later...

Just wanted to say thanks, this thread saved me 200 bucks. I almost bought an Nvidia GPU for plex transcoding but it's not needed cuz my Intel CPU has quicksync, followed the instructions and it works perfectly!

Link to comment
  • 2 months later...
  • 3 weeks later...
  • 2 weeks later...
On 2/13/2019 at 5:16 PM, lotetreemedia said:

***Update*** : Apologies, it seems like there was an update to the Unraid forums which removed the carriage returns in my code blocks. This was causing people to get errors when typing commands verbatim. I've fixed the code blocks below and all should be Plexing perfectly now :)

 

Y

===========

Granted this has been covered in a few other posts but I just wanted to have it with a little bit of layout and structure.

Special thanks to [mention=9167]Hoopster[/mention] whose post(s) I took this from.

 

What is Plex Hardware Acceleration?

When streaming media from Plex, a few things are happening. Plex will check against the device trying to play the media:

  •     Media is stored in a compatible file container
  •     Media is encoded in a compatible bitrate
  •     Media is encoded with compatible codecs
  •     Media is a compatible resolution
  •     Bandwith is sufficient

 

If all of the above is met, Plex will Direct Play or send the media directly to the client without being changed. This is great in most cases as there will be very little if any overhead on your CPU. This should be okay in most cases, but you may be accessing Plex remotely or on a device that is having difficulty with the source media.

You could either manually convert each file or get Plex to transcode the file on the fly into another format to be played.

 

A simple example:

Your source file is stored in 1080p. You're away from home and you have a crappy internet connection. Playing the file in 1080p is taking up too much bandwith so to get a better experience you can watch your media in glorious 240p without stuttering / buffering on your little mobile device by getting Plex to transcode the file first. This is because a 240p file will require considerably less bandwith compared to a 1080p file.

 

The issue is that depending on which format your transcoding from and to, this can absolutely pin all your CPU cores at 100% which means you're gonna have a bad time. Fortunately Intel CPUs have a little thing called Quick Sync which is their native hardware encoding and decoding core. This can dramatically reduce the CPU overhead required for transcoding and Plex can leverage this using their Hardware Acceleration feature.

 

How Do I Know If I'm Transcoding?

You're able to see how media is being served by playing a first something on a device.

Log into Plex and go to Settings >  Status > Now Playing

 

image.png.9cd4ae4363ae30830104928b8216beae.png

 

As you can see this file is being direct played, so there's no transcoding happening. If you see (throttled) it's a good sign.

It just means is that your Plex Media Server is able to perform the transcode faster than is necessary.

 

image.png.f9dc9b2bb939429edada4c935b7841f9.png

 

To initiate some transcoding, go to where your media is playing. Click on Settings > Quality > Show All > Choose a Quality that isn't the Default one

 

image.png.c517a8048527c23ad8ba422ff5efdef5.png

 

If you head back to the Now Playing section in Plex you will see that the stream is now being Transcoded.

I have Quick Sync enabled hence the "(hw)" which stands for, you guessed it, Hardware. "(hw)" will not be shown if Quick Sync isn't being used in transcoding.

 

PreRequisites

1. A Plex Pass - If you require Plex Hardware Acceleration Test to see if your system is capable before buying a Plex Pass.

 

2. Intel CPU that has Quick Sync Capability - Search for your CPU using Intel ARK

 

3. Compatible Motherboard

You will need to enable iGPU on your motherboard BIOS

In some cases this may require you to have the HDMI output plugged in and connected to a monitor in order for it to be active.

If you find that this is the case on your setup you can buy a dummy HDMI doo-dad that tricks your unRAID box into thinking that something is plugged in.

 

Some machines like the HP MicroServer Gen8 have iLO / IPMI which allows the server to be monitored / managed remotely.

Unfortunately this means that the server has 2 GPUs and ALL GPU output from the server passed through the ancient Matrox GPU. So as far as any OS is concerned

even though the Intel CPU supports Quick Sync, the Matrox one doesn't. =/ you'd have better luck using the new unRAID Nvidia Plugin.

 

 

Check Your Setup

If your config meets all of the above requirements, give these commands a shot, you should know straight away if you can use Hardware Acceleration.

Login to your unRAID box using the GUI and open a terminal window. Or SSH into your box if that's your thing.

Type:

 

cd /dev/dri
ls
 

 

image.png.9de37b4cc64ab331374ecc9e21f37e1a.png

 

If you see an output like the one above your unRAID box has its Quick Sync enabled. The two items were interested in specifically are card0 and renderD128.

If you can't see it not to worry type this:

 

modprobe i915
 

There should be no return or errors in the output. Now again run:

 

cd /dev/dri
ls
 

 

You should see the expected items ie. card0 and renderD128

 

Give your Container Access

 

1900818547_UntitledDiagram-Page-1.png.1e8a3cda3771d026d2dd8dbfc6aa43d3.png

 

Lastly we need to give our container access to the Quick Sync device. I am going to passively aggressively mention that they are indeed called containers

and not dockers. Dockers are manufacturers of boots and pants company and have nothing to do with virtualization or software development, yet. Okay rant over.

We need to do this because the Docker host and its underlying containers don't have access to anything on unRAID unless you give it to them.

This is done via Paths, Ports, Variables, Labels or in this case Devices. We want to provide our Plex container with access to one of the devices on our unRAID box.

 

We need to change the relevant permissions on our Quick Sync Device which we do by typing into the terminal window:

 

chmod -R 777 /dev/dri
 

 

Once that's done

  1. Head over to the Docker Tab,
  2. click on the your Plex container.
  3. Scroll to the bottom click on Add another Path, Port, Variable
  4. Select Device from the drop down Enter the following:

 

Name: /dev/dri
Value: /dev/dri
 

image.png.29c9e3f747da573cd996e7459ec19c1e.png

 

Click Save followed by Apply. Log Back into Plex and navigate to Settings > Transcoder. Click on the button to SHOW ADVANCED

Enable "Use hardware acceleration where available".

 

image.png.e6ee4c51219761eded26a316dd45b427.png

 

You can now do the same test we did above by playing a stream, changing it's Quality to something that isn't its original format and Checking the Now Playing section to see if Hardware Acceleration is enabled.

 

image.png.448e67bb89fb03886652d7f00b8b5df8.png

 

If you see "(hw)" congrats! You're using Quick Sync and Hardware acceleration [emoji4]

 

Persist your config

On Reboot unRAID will not run those commands again unless we put it in our go file. So when ready type into terminal:

 

nano /boot/config/go
 

Add the following lines to the bottom of the go file

 

modprobe i915
chmod -R 777 /dev/dri
 

image.png.ac780f8412108de519155289a3a3f9d6.png

 

Press Ctrl X, followed by Y to save your go file. And you should be golden!

 

 

Great. Thanks for the instructions. It finally worked :)

Finally, don’t forget to enable the GPU in Plex:plex-gpu.thumb.png.1548bcee226e0f9deb34bc168e027b84.png

Edited by Novaliz
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...