Jump to content
techsperion

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

78 posts in this topic Last Reply

Recommended Posts

***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

 

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!

 

Edited by techsperion
formatting
  • Like 5
  • Thanks 3

Share this post


Link to post

Hi, followed your instructions and  /dev/dri is there with correct output, but no hw transcoding! When I try chmod -R 777 /dev/dri I get command not found! I tried with sudo and same error?

 

Cheers,

Tim

Share this post


Link to post

Hi thanks for your great guide.

According to plex's definition, they don't support QSV at linux but only support at windows.

But seems you made it working. Do I understand correctly?

Share this post


Link to post
6 hours ago, Fordarm said:

Hi thanks for your great guide.

According to plex's definition, they don't support QSV at linux but only support at windows.

But seems you made it working. Do I understand correctly?

They support it just fine. I've used QSV with the Plex Docker with both an older Ivy Bridge i5 3470 and my current Coffee Lake i5 8400. It works great!

Share this post


Link to post

Just reporting that this worked great for me on my headless ThinkServer TS140 server with a Xeon CPU E3-1245 v3.  Thanks again.

Share this post


Link to post

Is there a equalent GPU acceleration plugin for AMD graphics cards? I have a rx 570 that would love to do GPU acceleration. I got so frustrated with Nvidia that i returned the used GTX 1060 i purchased to the seller after a long error 43 battle. So i´m not interested in buying Nvidia hardware again.

Share this post


Link to post

WOW!!! I clicked on this out of curiosity, but this little piece of info regarding HDMI dummy plugs is going to make my remote-VM life so much better! was so tired of constantly readjusting the resolution of my OSX VM.
thank you!!!

here's an updated link of the product, perhaps @techsperion could update his link!
https://www.amazon.com/Display-Emulator-Headless-Display(Fit-Headless-1920x1080-3840x2160/dp/B074NNZYW4

Share this post


Link to post
WOW!!! I clicked on this out of curiosity, but this little piece of info regarding HDMI dummy plugs is going to make my remote-VM life so much better! was so tired of constantly readjusting the resolution of my OSX VM.
thank you!!!

here's an updated link of the product, perhaps [mention=88230]techsperion[/mention] could update his link!
https://www.amazon.com/Display-Emulator-Headless-Display(Fit-Headless-1920x1080-3840x2160/dp/B074NNZYW4


Thanks buddy. Updated the post with your link. Hope your Hackintosh works okay :)


Sent from my iPhone using Tapatalk

Share this post


Link to post

I followed the instruction but it is still not working. I can see that plex can see the iGPU but for some reason it is not using it 

Screenshot_2.png

Share this post


Link to post
3 hours ago, niomar said:

I followed the instruction but it is still not working. I can see that plex can see the iGPU but for some reason it is not using it 

Screenshot_2.png

All looks good in the terminal.

 

How have you established it's not working? If you change the playback settings to a non native one and check the Now playing section - What does it show? Share the screen shot if possible.

Share this post


Link to post

Just to double check - is my hardware transcoding really working?

IMG_20190806_214244.jpg

Share this post


Link to post
Just to double check - is my hardware transcoding really working?
IMG_20190806_214244.thumb.jpg.6424779dd1117964df14a4871f191ed3.jpg



It is indeed



The public only see the accomplished trick;
They have no conception of the torturous preliminary self-training that was necessary to conquer that fear.
- J.C Cannell, The Secrets of Houdini

Share this post


Link to post
Posted (edited)
On 8/2/2019 at 4:01 PM, techsperion said:

All looks good in the terminal.

 

How have you established it's not working? If you change the playback settings to a non native one and check the Now playing section - What does it show? Share the screen shot if possible.

It says only transcoding without the hw. 
when i use my gpu it says transcoding hw. I have the iGPU set as primary in the bios that is no problem right? 

AB7EA609-74C1-45D7-AF18-13521148A94F.jpeg

Edited by niomar

Share this post


Link to post
3 hours ago, niomar said:

It says only transcoding without the hw. 
when i use my gpu it says transcoding hw. I have the iGPU set as primary in the bios that is no problem right? 

AB7EA609-74C1-45D7-AF18-13521148A94F.jpeg

What processor are you using? Does your motherboard have IPMI?

Share this post


Link to post
3 hours ago, ramblinreck47 said:

What processor are you using? Does your motherboard have IPMI?

I have a Asrock Z390 Extreme 4 with a I7 - 8700 cpu

Share this post


Link to post
9 hours ago, ramblinreck47 said:

What processor are you using? Does your motherboard have IPMI?

Sorry, what do you mean by when you use your GPU it says transcode HW?

 

Are you passing your GPU to the container?

 

are you booting unRAID in non GUI? Have you got any other containers that could be using your iGPU? Also is iGPU enabled in the bios?

Share this post


Link to post
21 minutes ago, techsperion said:

Sorry, what do you mean by when you use your GPU it says transcode HW?

 

Are you passing your GPU to the container?

 

are you booting unRAID in non GUI? Have you got any other containers that could be using your iGPU? Also is iGPU enabled in the bios?

I user to have a GTX 1060 passed to the plex docker and that was working fine. I removed it. Unraid is running non GUI and iGPU is enabled in the bios. 

Share this post


Link to post
4 hours ago, niomar said:

I user to have a GTX 1060 passed to the plex docker and that was working fine. I removed it. Unraid is running non GUI and iGPU is enabled in the bios. 

Ah okay - Are you back on stock unRAID now? btw just saw Slaapkamer XD is jy afrikaans?

 

Share this post


Link to post
11 minutes ago, techsperion said:

Ah okay - Are you back on stock unRAID now? btw just saw Slaapkamer XD is jy afrikaans?

 

Not on stock unraid, should i do that?

hahah no i am Dutch from the Netherlands 

Share this post


Link to post
Just now, niomar said:

Not on stock unraid, should i do that?

hahah no i am Dutch from the Netherlands 

I’m not sure if that’s messing with things. Have you got a spare usb lying around to install a test unRAID with?

Share this post


Link to post
8 minutes ago, techsperion said:

I’m not sure if that’s messing with things. Have you got a spare usb lying around to install a test unRAID with?

Yes i have. I will make a new usb to test with. 

Share this post


Link to post
On 8/9/2019 at 6:23 PM, techsperion said:

I’m not sure if that’s messing with things. Have you got a spare usb lying around to install a test unRAID with?

I got it working now! i needed to uninstall the nvidia version of unraid (back to stock) and that did the trick! thank you for helping

Share this post


Link to post

Great instruction !!
I used it for EMBY and Hadrware Transcoding also works.
Thank you

Share this post


Link to post

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.