Guide: NVDEC Hardware Acceleration Patch for Plex Media Server on Linux

So where does a fix need to be made? In Plex code?

It requires a code change in Plex as it needs filters that are not built in to the custom FFMPEG build Plex uses.
With that said, the filters are CPU only and single threaded, so it’s not a good option for 4K content regardless

1 Like

Thanks for the work. However, I am having issues with this patch. I am not entirely sure it’s working or if my problem is something else. I have recently upgraded my plex server and added a Quadro P2000, but I disabled the integrated GPU because I wanted only to use my P2000. However, whenever I play a h265 video on a device that does not support h265 the GPU fails to transcode and falls back to CPU which fails to transcode as well. I get a green video screen and audio (no video) on the client. It doesnt seem to matter the resolution, it’s unable to handle HEVC at all.

This what passed to the transcoder.

15968 ?        Rl     0:25 /usr/lib/plexmediaserver/Plex Transcoder2 -hwaccel nvdec -codec:2 hevc -hwaccel:2 vaapi -hwaccel_fallback_threshold:2

I’ve tried this patch but it hasnt changed anything, but perhaps I am doing something wrong? I am using Ubuntu 18.04LTS and ā€˜nvidia-smi’ reports the driver version to be 430.09. My Plex version is 1.15.5.994. Any and all help would be greatly appreciated. I spent the money on this because I thought it’d help me handle my HEVC content better.

are you running headless? if so try attaching a monitor.

if it works with a monitor, you will need to leave it attached or buy a dummy/fake monitor plug. They are available at amazon.

another potential gotcha, if your previous iGPU drivers are still installed, you may want to remove them.

I actually have a dummy plug connected to my NVIDIA card currently. It appears that the NVIDIA GPU is used for transcoding h264 content but as soon as I try HEVC content it fails and tries to transcode on the CPU (which chokes).

Did you remove the intel drivers?

How did you disable the igpu, in the bios? if not disable it in the bios and remove intel video drivers if you have not already.

I am using same patch and drivers on gtx 1650 (and p400 previously) with no issues.

I am on debian though.

I’m trying to figure out how to remove the intel drivers in ubuntu… any idea?

no idea. I’d start with google though.

I haven’t been able to get this to work. Could it be because the card I’m using does not support NVENC? I have a i7-5820k and a GT 1030 (I know I should have gotten a 1050 but I needed something ASAP after my AIO killed my 1070 and bestbuy was out of the 1050). From the transcoder logs I see this line: transcodeHwRequested=ā€œ1ā€ transcodeHwFullPipeline=ā€œ0ā€. No processes are shown as running on the GPU.

I’d bet those logs are in regards to the encoder, since the decoder is basically being hard coded into the ffmpeg command line via the patch, I would think that its not going to display any logs.

I would still expect you should see the DECode thread in nvidia-smi, but yes otherwise the cpu will do the ENCoding.

it looks like you got the latest drivers, if this is running headless, try attaching a monitor, or dummy plug.

It’s not running headless. However, it’s using OMV as an OS so there’s no window manager running except through remote desktop.

Unfortunately the 1030 only includes a NVDEC and not a NVENC chip. You can disable Hardware Transcoding in Plex (or leave it enabled for Intel QuickSync), but use the NVDEC patch to use it for decoding only. Decoding only does not need the Hardware Transcoding enabled in Plex.
https://www.elpamsoft.com/?p=Plex-Hardware-Transcoding

1 Like

Available codec options are:

Please forgive my ignorance, but what makes mpeg2video and vc1 ā€œunsupportedā€? What would happen if I enable them?

Firstly, a big THANK YOU to everyone that gave input / effort to mitigate this -hwaccel nvdec work around.

I have a problem where the script is not processing the ALLOWED CODECS as it should.
I Installed the latest version of the script as of 5/27/2019 from git/plex-nvdec

The logic for example never matches h264 and does not append -hwaccel nvdec.
I can override in the script to append [-hwaccel nvdec] to all calls but that isn’t the intended selective use…
Is there any advise anyone may have on this.!

Platform:
CentOS Linux release 7.6.1810 (Core)
NVIDIA-SMI 418.67
Driver Version: 418.67
CUDA Version: 10.1
GPU: P2000
plex_trancoder_calls|690x428

IDK about all of you, but I am damn sick of waiting for Plex to enable this capability by default. If you look at how long this has been a request and how long it’s been capable with hacks, it’s really just ridiculous that Plex can’t get their dev pipeline in order enough to get this pushed to prod.

I’ve been pretty patient, but with each PMS update that comes out and doesn’t support this, I get a little more pissed off. Plex, you suck.

3 Likes

if it works for you with the hack, then why does it matter when plex releases it publically?!?!!

:thinking:

I’m not using the wrapper any more because I don’t want to manually patch after every update, and some of the behavior is still a bit odd with the patch. So I upgraded to an 8700k because I was sick of screwing around.

I care because I initially bought a video card to try to breathe life into my 4690k, and I’d rather be saving the CPU time for other tasks. I care because I paid for this product and the company behind the product is asleep at the wheel. This isn’t the only major issue Plex can’t seem to remedy while they keep adding dumb ā– ā– ā– ā–  most people don’t care about while ignoring broken core functionality.

2 Likes

Patching literally takes 5 seconds.

Open putty > ctrl R > search nvdec > return.

Patched. Takes longer to upgrade plex

1 Like

Has anyone had any luck using this script with a docker installation? I can’t find the plex directory to manually point the script at it either.

Edit: I got it working using the script here https://github.com/zacharyd3/plex-nvdec

that link didnt work for me, but looking at it you would have to make some significant changes to your setup depending on your setup

For my docker I did the following
opened the docker terminal

cd /usr/lib/plexmediaserver
ls

just to check everything is normal

apt-get update
apt-get install nano
nano plex-nvdec-patch.sh

past in revr’s code (you are a legend)

chmod +x ./plex-nvdec-patch.sh
bash -c ./plex-nvdec-patch.sh

I then ran

nvidia-smi dmon -s u

on the unraid tower terminal which showed it enc and dec

1 Like