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

@rajil_s, at this point I think the issue is beyond what I can help with. I’m not familiar with LXD on Arch. To compound the issue, the 1030 card is unique in that it supports NVDEC and not NVENC. There could be more complication here than just simply getting everything set right on the LXD profile.

Plex with hardware acceleration on containers is very much a no man’s land right now. LXC on Proxmox seems the most common deployment here, but outside of that it’s going to be very hard to validate. I can say I’m doing LXC with passthrough ok a Debian container with Proxmox, but your mileage may vary a lot with such an infrastructure

1 Like

anyone else noticed occasional audio/video getting out of sync ?

not sure if its the hardware (gm206) or the media or something yet with the transcoder work.

Media

  • Duration 53:23
  • Bitrate 5783 kbps
  • Width 1920
  • Height 1072
  • Aspect Ratio 1.78
  • Video Resolution 1080p
  • Container MKV
  • Video Frame Rate 24p
  • Audio Profile ma
  • Video Profile main 10

Part

  • Duration 53:23

  • File .mkv

  • Size 2.16 GB

  • Audio Profile ma

  • Container MKV

  • Video Profile main 10

  • Codec HEVC

  • Bitrate 4247 kbps

  • Bit Depth 10

  • Chroma Subsampling 4:2:0

  • Color Range tv

  • Frame Rate 23.976 fps

  • Height 1072

  • Level 4.0

  • Profile main 10

  • Ref Frames 1

  • Width 1920

  • Display Title 1080p (HEVC Main 10)

  • Codec DCA

  • Channels 6

  • Bitrate 1536 kbps

  • Language English

  • Audio Channel Layout 5.1(side)

  • Bit Depth 24

  • Profile ma

  • Sampling Rate 48000 Hz

  • Title DTS-HD Master Audio / 5.1 / 48 kHz / 3664 kbps / 24-bit

  • Display Title English (DTS-HD MA 5.1)

  • Codec PGS

  • Bitrate 5 kbps

  • Language English

  • Header Compression true

  • Display Title English (PGS)

  • Codec PGS

  • Bitrate 13 kbps

  • Language English

  • Header Compression true

  • Display Title English (PGS)

  • Codec SRT

  • Format SRT

  • Display Title Unknown (SRT External)

This is really great news! While it’s been fun, I’ll be happy to put all of these hacks behind me and have official support. HW transcoding isn’t working smoothly with Nvidia GPU

Wow! This made a much bigger difference than I thought it would! I went from around 80-85% CPU usage on a H.264 1080p transcode to around 15-20%!

I mean, ok I might have a 9 year old processor but it was high-end when I bought it (plus I overclocked it) so I figured software decoding of 1080p content was not a big deal and it was all about the encoding (i’ve had NVENC working for a while). I guess I was wrong! Great work.

A lot of my friends had started to use my server, so I was even thinking of buying a new computer to handle the transcoding load (two people couldn’t transcode 1080p at once). Now I don’t have to! I just need my old GFX card and a 9 year old CPU. This is great, really, absolutely great. Thanks so much. This really makes Plex practical on hand-me-down gaming rigs repurposed as servers. I was literally pricing out something on newegg this week.

1 Like

Awesome script, works great for me currently with my p2000. I had 6 4k streams going and GPU was sitting on 35-40% gpu. CPU was like 10%. This is going to be great once finally officially supported.

Is this script no longer working with the latest Plexpass version of PMS? I’m running the script (as a User script in Unraid), it says “already applied” yet it doesn’t appear to be working as you can see here.

Capture

I’ve just checked and all is working here, but I’m running fedora. Had to re-apply the script as latest version did update the transcoder, but all seems to be working according to netdata.

You’re using PMS Version 1.15.5.994 and you’res seeing Plex Transcoder 2 in netdata?

you might need to pull the latest version of the patch

it worked for me with 1.15.994

Nvmd, I realized I was running a different script that is more optimized for Unraid. I didn’t realize they weren’t one in the same. Sorry guys. I had to pull a new version of that script and now it’s working.

Has there been any updates regarding TrueHD 7.1 multi-threaded decoding?

I’m upgrading CPUs in my server but the new server has slightly worse single-thread performance (but incredibly higher multi-thread/cpu performance) and I’m a bit concerned about this?

1 Like

thanks for the wrapper, i am using it on an intel xeon 1240v2 esxi system with passed through P400. While everything seems to work pretty smooth now, i am not seeing as much decrease in cpu usage with nvdec compared to using quicksync for decoding. With a intel graphics 620 on a nuc i can reach like 5% CPU usage on transcoding h264/h265 content while the nvdec solution seems to use around 30% CPU on the xeon. Of course this is still a very nice solution for retro fitting so i merely want to share my personal testing experience compared to current quicksync.

p400 works for me on bare metal proxmox.
p400 will only support one 4k transcode (uses 1400meg out of 2000 video ram)

unless they can optimize memory usage drastically when they release the public update.

This is unlikely to happen. All audio transcodes with FFMPEG are single threaded. It sounds like there’s significant technical hurdles to multithread the workload without causing quality or audio loss

for anyone curious about gtx 1650

image

2x 4k transcodes work
+1x 4k transcode fall back to cpu decode + gpu encode

note gpu memory 4 gig not quite enough for 3 gpu decodes

Unless they can do a ton more optimization of memory usage of the linux nvdec, @~1.4 gig video ram per 4k transcode

2g p400 = 1x 4k xcode
4g 1650 = 2x 4k xcode
5g p2000 = 3x 4k xcode
8g 1080 or whatever = 5x 4k xcode

for whatever reason, VIDEO RAM is the bottleneck for linux transcoding.

If you need more transcodes per ram, then windows is apparently way more efficient and your best bet, instead of linux.

3 Likes

Running this patch with the latest Plex Media Server version (1.15.5.994) in the official Docker container (plexinc/pms-docker:plexpass) doesn’t seem to work.

I keep getting a bunch of these errors whenever I try to transcode anything:

[FFMPEG] - libva: va_getDriverName() failed with unknown libva error,driver_name=(null)
[FFMPEG] - Failed to initialise VAAPI connection: -1 (unknown libva error).

Any ideas?

i’m also having a problem with image quality when using this patch on certain 4k content files.

see here: https://imgur.com/a/gUx4KfN

the first image is without the patch, with CPU decoding, the second pic is with the patch applied with a GTX 1660 decoding.

1 Like

gsrcrxsi, this is due to converting 10 bit HDR to SDR (8 bit). It looks like it is more pronounced with NVDEC than by software, but color information is just dropped as opposed to resampled.

Leyaena, that log message is pretty standard if you do not have support for QSV. Was there any other log message?

I’m not sure 10bit HDR is solely the cause. I have several other 10bit HDR titles that do not do this. Why wouldn’t they exhibit the same problem?

Also. If that is the problem, where does the fix lie? In Plex, in the patch, or in the NVDEC hardware itself? Hardware Decode support is what takes most of the muscle to process.

There’s a really good write-up on this here: https://stevens.li/guides/video/converting-hdr-to-sdr-with-ffmpeg/

I also see the artifacts on some of my HDR content but not others, but it is very much due to the handling of the color space. Even the software renderer doesn’t do the resample required, so all colors are washed out if compared to an SDR content source