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


323 posts in this topic Last Reply

Recommended Posts

  • Replies 322
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular 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 verbat

Please be courteous and respectful to one another. Thank you

You might find this useful (Yes means the iGPU can both encode and decode.):   BTW: this chart is from the Quick Sync Video Wikipedia page.  

Posted Images

@Geran just give the instructions in that thread a try and report back if you have any issues. Multiple people in that thread had success with Plex and QuickSync with IPMI onboard.


78bce6387903c721d2ac3caa989c18f5.jpg

Is it just me getting this error for that thread?


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

Link to post
On 11/12/2019 at 3:27 PM, techsperion said:

 


78bce6387903c721d2ac3caa989c18f5.jpg

Is it just me getting this error for that thread?


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
 

 

I don't see anything like that. Thread looks normal to me.

Link to post
On 11/12/2019 at 3:04 PM, ramblinreck47 said:

@Geran just give the instructions in that thread a try and report back if you have any issues. Multiple people in that thread had success with Plex and QuickSync with IPMI onboard.

Hi,

 

So I tried this and everytime I turn on Hardware transcoding it kills the Plex Media Server application.

Link to post
  • 1 month later...
5 hours ago, Supa said:

Thanks got it running. Now to figure out what to do with all my audio formats. Any suggestions? 

 

UAkGEgE.png

Audio transcoding takes up so little CPU power most people don’t end up doing anything with it. Ideally if you wanted to make sure audio is not transcoding,

you could either get a different sound system/media player or just pre-encode all your media to AAC Stereo (which will Direct Play on practically everything).

Link to post
  • 2 weeks later...

So this isn't really about plex, but people doing quick sync on unraid have a similar use case to me. I've found that once I modprobe the i915 my nvidia card just gives a black screen when passed through. If I don't modprobe after boot it works fine.

 

In my case the igpu is primary, nvidia is secondary.

I found if I pass the nvidia through (so its in use) and then modprobe, things are OK.

Based on that I added nvidia to vfio pci ids in syslinux.cfg, and confirmed vfio was in use at boot. The modprobed but it still broke nvidia passthrough!

 

This is perplexing to me. i915 shouldn't be able to taint the nvidia card in my mine, since its not a compatible driver. I assumed all the displays were reignited or something when the driver loaded and this was tainting the nvidia card somehow, but if its bound to vfio I don't see how it should be able to get at it at all.

 

I think I can workaround this with scripts and a dummy vm to "protect" the nvidia card from i915 but that seems ridiculous.

 

Anyone else seeing this behavior or is it just me? I've only tried nvidia on seabios vms so maybe that is a component.

Link to post
45 minutes ago, scorcho99 said:

So this isn't really about plex, but people doing quick sync on unraid have a similar use case to me. I've found that once I modprobe the i915 my nvidia card just gives a black screen when passed through. If I don't modprobe after boot it works fine.

 

In my case the igpu is primary, nvidia is secondary.

I found if I pass the nvidia through (so its in use) and then modprobe, things are OK.

Based on that I added nvidia to vfio pci ids in syslinux.cfg, and confirmed vfio was in use at boot. The modprobed but it still broke nvidia passthrough!

 

This is perplexing to me. i915 shouldn't be able to taint the nvidia card in my mine, since its not a compatible driver. I assumed all the displays were reignited or something when the driver loaded and this was tainting the nvidia card somehow, but if its bound to vfio I don't see how it should be able to get at it at all.

 

I think I can workaround this with scripts and a dummy vm to "protect" the nvidia card from i915 but that seems ridiculous.

 

Anyone else seeing this behavior or is it just me? I've only tried nvidia on seabios vms so maybe that is a component.

I had this a couple of times. Have you tried a dummy HDMI plug? https://www.amazon.com/Emulator-Headless-Display(Fit-Headless-1920x1080-3840x2160-60Hz)-2Pack/dp/B074NNZYW4

 

solved it for me!

Link to post
9 minutes ago, techsperion said:

I had this a couple of times. Have you tried a dummy HDMI plug? https://www.amazon.com/Emulator-Headless-Display(Fit-Headless-1920x1080-3840x2160-60Hz)-2Pack/dp/B074NNZYW4

 

solved it for me!

I don't think that is it because its plugged into a monitor the whole time. It also worked reliably until I started this whole i915 adventure. Although maybe there is something going on there.

Link to post
15 minutes ago, scorcho99 said:

I don't think that is it because its plugged into a monitor the whole time. It also worked reliably until I started this whole i915 adventure. Although maybe there is something going on there.

Ah good point :/ You on stock Unraid or the Nvidia one? Tried another VM? Also are you using the Graphic ROM Bios?

 

 

Link to post
  • 3 weeks later...

RIP your CPU ☠️

Sorry wasn't too sure on your question.

 

If you meant CPU usage

- I think you can see this on the dashboard

 

If you meant weather your GPU or iGPU is being used in the transcode

- depends which one you've given your Plex container access to. If you're using a stock version of Unraid, it can and will only by your iGPU. 

 

If you meant is your iGPU being used for transcode

- You'll see (hw) in the Plex status page

 

Link to post

I built an unRAID server for personal use with low power consumption parts (msi Z270 + i5-7600k) and chose to use the built-in HD630 iGPU for the few times it needs to transcode media. Most of my content is played locally on a Shield TV, but when streamed remotely it can now handle a few streams without touching the CPUs. I followed this guide and enabled hardware acceleration working on Plex (linuxserver) within minutes thanks!

Link to post

Thanks for the clear tutorial! However, I unfortunately can't get hw transcoding to work. Made sure to follow each step in this tutorial, but when I play media that needs to be transcoded, I see no (hw) in the stream details and my CPU kicks in to 100%.

 

When I open the console on the Plex docker, I see the /dev/dri devices present. Both card0 and RenderD128 have rwx rights. When I was running Plex on my previous OS (same hardware, also running Docker), hw transcoding was working like a charm.

 

I'm probably doing something wrong, but I can't figure it out. Any ideas? I can share log files if required.

 

Running UnRaid 6.8.2 on an Asustor Nimbustor 4 (Celeron J4105)

Link to post

I'm running an older SandyBridge i7-2600, and I am unable to get Quick Sync enabled.

I have verified that it is in fact ENABLED in the bios.

 

My motherboard is an odd one (MSI-P67A-GD65) that has no onboard HDMI ports of any kind (Even though every cpu it supports appears to have an iGPU on it) but the bios explicitly has an option to enable/disable Quick Sync. This lack of HDMI port makes it impossible to try the dummy-dongle trick.

 

When i run modprobe i915, it executes without any output, the module loads, but I get no /dev/dri.

Is there a way to force this?

I know my cpu is old, and it's quicksync support is crappy, but it's one of those things... If you can configure the software to use it, why not?

(unRAID 6.8.2)

Edited by SeeGee
Added unraid ver
Link to post
  • 3 weeks later...
On 2/13/2019 at 5:16 PM, techsperion 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.png

 

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!

 

Thank you!

Link to post
  • 1 month later...

Just got server up tonight and I'm coming from Freenas.  I keep asking myself, why did I wait so long..LOL!  Great information in this thread!  Awesome instructions as well! I have noob question, I currently have my transcoding going to RAM (32GB) on my server, and I have a fair share of users who can direct stream almost all of my content.  Question, which would be better using my i9-9900k via quicksync or keep transcoding to RAM?  Any issues with having both enabled?  

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.