Hardware Accelerated Decode (Nvidia) for Linux

Hi there, I’m new to Plex and this is my first post.

What I’m requesting is : Hardware Accelerated Decode with Nvidia Cards for Linux. I think this feature will be super helpful to cut down the CPU overhead when transcoding videos on a Linux server.

I’m using plex server with Ubuntu(18.04 beta) for now and I have a GeForce GTX1050 card installed on my HP MicroServer Gen10. The CPU(AMD Opteron X3216) is very slow and that’s why I bought the video card.

I’ve tried turning on the hw acceleration in the settings and my cpu usage is still 100% when transcoding videos due to the lack of hw decoding. I’ve tried transcoding the same video using the latest Emby beta version, which has both hw encode & decode features for Nvidia cards. My cpu will perform at around 40%-80% when both hw encode & decode is activated.

Will you guys add this Nvidia hw decode feature to Plex server for Linux versions? I don’t know if I’m right but I think it’s just an extra option when compling ffmpeg. I prefer using Plex and really don’t want to switch to Emby. I’d really appreciate it if you would add this feature in the coming releases. If you don’t plan on implementing it, please also let me know. Thank you and sorry for my broken English.

Give this article a read.

https://support.plex.tv/articles/115002178853-using-hardware-accelerated-streaming/

@drevilish said:
Give this article a read.

https://support.plex.tv/articles/115002178853-using-hardware-accelerated-streaming/

I’ve read that. In fact that’s the very article which confirms there’s no support for HW decoding on linux with NVIDIA cards.
Here’s what it says in the “Linux system requirements” section:

If your computer has an NVIDIA GPU, please install the latest Latest NVIDIA drivers for Linux to make sure that Plex can use your NVIDIA graphics card for video encoding (only) when Intel Quick Sync Video becomes unavailable.

3 Likes

+1 vote for this. I have a physical server which hosts my Plex among other work related workloads. Due to this, Plex needs to be virtualized and my server does not support PCI passthrough. This means I cannot pass through the GPU to a Windows VM. So, my workaround here is running Plex on a LXC container and sharing the physical GPU from the host to the container.
Plex itself works great, but I cannot even try to spin up 4K media due to the lack of NVDEC support on Linux.

The FFMPEG library added support for NVDEC in Nov-2017. https://www.phoronix.com/scan.php?page=news_item&px=FFmpeg-NVDEC-HEVC-VP9

I’ve been hoping to see this added, which would hopefully just be updating the library in use. Please add support for this!

I currently use HW transcoding with nvidia in linux, so yes it does work. You will need to post questions on what you are doing wrong to get it working. I currently use it with my P2000 and it works amazingly well, so well in fact I recommend it over a large CPU.

1 Like

There is constant misunderstanding of what is and is not supported with Linux and hardware transcoding…
Plex on Linux supports all platforms for hardware encoding, and my M2000 handles that like a champ.
Plex on Linux ONLY supports hardware decoding with Intel’s Quicksync. This is due to the FFMPEG library version that Plex uses which does not support NVDEC. This means any Intel Xeon CPUs with Nvidia GPUs are stuck with software decoding (like my DL 380 server). This is fine for 1080p media, but even 12 CPUs will choke on software decoding 4K media and the transcoder will crash.

4 Likes

I think I am confused, you are correct. I currently use a P2000 in my PMS and can easily have more than 5 4k transcodes going live without even coming close to maxing out the GPU. That is, to be clear, over 5 people playing 4k media off my server being transcoded live so they can watch, and it works without issue.
Running standard linux-generic-hwe-16.04 with the basic nvidia drivers and everything seems to work without issue. Mind you, when someone plays 4k content and it needs to transcode it it does not do the audio, CPU has to do that, but everything else goes to my P2000. Can you explain what it is you guys are doing that does not go to your GPUs?

Here is 4 live transcodes going:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.59                 Driver Version: 390.59                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro P2000        Off  | 00000000:01:00.0 Off |                  N/A |
| 50%   41C    P0    20W /  75W |    280MiB /  5057MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0     18862      C   /usr/lib/plexmediaserver/Plex Transcoder      62MiB |
|    0     20982      C   /usr/lib/plexmediaserver/Plex Transcoder      77MiB |
|    0     21029      C   /usr/lib/plexmediaserver/Plex Transcoder      68MiB |
|    0     21131      C   /usr/lib/plexmediaserver/Plex Transcoder      62MiB |
+-----------------------------------------------------------------------------+

1 Like

The Plex Transcoder for linux needs an update to support decoding. Currently the Plex Transcoder ONLY supports hardware encoding for linux and NOT decoding.

With an updated FFmpeg then the P2000 (for instance) will support BOTH decoding AND encoding. It does not require QSV to function correctly.

If you look boboki, your CPU is still being used to decode the stream, then the encode occurs on the P2000.

4 Likes

hmmm I assumed that was just the audio stream being transcoded, perhaps that answers why after 7 4k streams my i7-2600k was being owned. I thought the audio should not take THAT much cpu. Thank you for explaining this to me, +1 me up sir!

From what I can see, the ffmpeg-2018-03-22.tar.gz source is based off of ffmpeg 3.4 (plex-media-server-ffmpeg-gpl-09988bd25fb23a0b2386468667d51ae2349d6516). Once this is updated/rebased to ffmpeg 4.0+, support for NVDEC will be included: https://github.com/FFmpeg/FFmpeg/blob/release/4.0/Changelog - “NVIDIA NVDEC-accelerated H.264, HEVC, MJPEG, MPEG-1/2/4, VC1, VP8/9 hwaccel decoding”

Is this already on the roadmap perhaps?

@gbooker02

Any idea if an up to date ffmpeg library is on the horizon ? ETAish ?
That would enable some serious transcoding with a p2000 …

The problem isn’t that ffmpeg doesn’t have support, it is that you have to compile cuda support in. So the Plex Transcoder could add support just by adding the needed libraries, but for what ever reason they have chosen not to. It might be a lot deal with the cuda libraries compatibility with certain nvidia drivers that is causing them to pause. You can get the Plex Transcoder source and compile it yourself, but I haven’t gotten it to work cleanly.

1 Like

Oh man, if someone could make this happen this would be amazing.

Ffmpeg supported nvidia decode since forever.

The issue here is that when plex compiled their transcoder (which is ffmpeg) they specified all encoder and decoders one by one. Although they included nvenc, which is the encoder, they did not include cuvid, which is the decoder. When I brought it up a year ago, they weren’t interested in fixing it that way, but instead said nvidia on linux was not officially supported.

Their point was that they would like to include the display drivers in their package before they officially support a platform, like they do with intel igpus. At the time they were waiting for open source drivers to include nvidia hw encode/decode (through vaapi) so they could include those instead of the closed source nvidia drivers (cuvid and nvenc). But I guess that didn’t happen yet? I don’t know, I stopped following.

Anyway, here’s the convo I had with the plex team a year ago: Plex Media Server - Hardware Transcoding Preview 4 (1.8.1.4140)

2 Likes

I wonder if @ChuckPa has an update for us then? I mean, since VAAPI did not happen, and the popularity of the Quadro series is now finally starting to get serious attention (and it is amazing) I would think maybe it is time they jumped and just went ahead and did it? I know I certainly would love to really use my P2000 for both sides and just watch my PMS blaze those users :wink:

1 Like

I have updates, I’m not sure if you’ll find them of particular interest :wink:

I can tell you I’ve been super busy working on stuff.
Some of what I did is already visible but nobody’s seen what we the team has been up to.
You’re about to.

You’ll see the fruits of some required steps in a couple weeks or less. (last minute tweaks to make it perfect).

I cannot, will not, and will never consider speaking directly to the FFMPEG question but do ask everything to think about the differences between a free public program and business.

One thing I can speak directly to:

Next Thursday, which is Good Friday,
There’ll be a Ladies meeting for Men only.
We’ll have plenty of square tables with round corners.
You’re all welcome to pull up a chair and sit on the floor.

:smiley:

4 Likes

+1 vote, i have a Quadro p2000 card and i need hw decode on linux, now it’s complicated for me to switch to windows (filesystem, without ssh, etc)

I would appreciate it

2 Likes

Is it possible just to get the “./configure” params you guys use for building ffmpeg? I am sure you are building off static libraries, and I am comfortable setting that up, I am just trying to see if I can get a stable copy of Plex Transcoder to compile.

That information is considered Company Confidential.

Sorry.

1 Like

Thank you for coming into this ChuckPA. You guys are always working on interesting stuff. In regards to NVDEC on Linux, you had stated above you would not want to comment regarding FFMPEG, so I won’t press that.

But would you be willing to comment if there is any roadmap item to support this?

At this point, to really start doing 4K media, I have to build a dedicated, purpose built, Plex box with a mix of consumer and professional hardware as opposed to leveraging my existing hardware. I would like to see if I should plan that in my budget or not if possible.

Definitely appreciate the work you guys do, thank you.

1 Like