Jump to content
techsperion

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

3 posts in this topic Last Reply

Recommended Posts

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 @Hoopster 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 yusuflimz
formatting
  • Upvote 4

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now