[Guide] Hardware Transcoding: The JDM way! QuickSync and NVENC

Hmmmmm. Not sure of the ins and outs much, I’ve just been following the scripts on the Unraid forum.

Doesn’t use any processor when I use it:

image

I wonder if it’s not reporting correctly then, I guess that’s a possibility…

However, don’t forget that transcodes get segmented, so it’s possible that your transcode is just parked at the moment of that screenshot. Have any historical usage?

I’ll load up a few streams later on and see what the CPU look like during the entire thing. I’ll report back here when I do.

1 Like

QuickSync reporting in (i7 7700, full decode/encode):

image

Here are some screenshots with 5 transcodes.

1 Like

Very odd that it’s not reporting that it’s decoding. Thanks for sharing though, I’ll have to look into it!

JDM - thanks a lot for this detailed write up! Incredible work as always. My question might be a little obvious, but is this instance of Plex supposed to replace my main Plex server? Or is this ONLY for transcoding. It might be obvious to you but if this is a separate, transcoding only server, then how do you tell the client to call the transcode server for transcodes and everything else to call the main server?

The easiest way is to share only one server to one client. Whether you run two servers or one is up to you. Share the hw transcode server with clients who have to transcode. Share the regular server (if different) with those who direct stream.

Oh, I suppose I didn’t specify! I would replace your main Plex server with this entirely.

There’s currently no way to load balance between multiple servers, and I doubt there ever would be really. The only way to make that happen is to have multiple servers, only share the transcoding server with the users that transcode, and only share the other one with the users that don’t.

Got it thanks!

Here’s what 9 hardware transcodes looks like on my i5-8500T.

It’s doesn’t report right in plex because of the way its hacked. The script hijacks the call plex makes to ffmpeg to add the missing NVENC flags. The author of the script has been in contact with Plex, but I don’t think they want to admit it was so easy to solve. I have been running the unlocked drivers and the hacked together script and it works well. The video ram is the limiting factor for 4K transcodes as its using about 1gb per 4K transcode. I have run out of clients to test 1080p transcodes but it will do at least 10 without breaking a sweat. I have found the quality to be just as good but I am not a super particular. The offloading of the occasional transcode has allowed me to swap my higher power e5-2667 processors for e5-2650l v2 processors and still not come anywhere near maxing it out.

I will agree it’s alittle to janky for prime time, but it is an option for those willing to go just alittle bit into the weeds.

Plex script discussion
Plex NVDEC script github

At first I didn’t see the logic in the build, since I have a beefy anniversary build in my server rack already running dual e5-2697 v2’s, 128gb ram, and a total of 42 tb storage. I was however having issues with Plex coming to a grinding halt at times and the ability to run a max of 8 transcodes but at the cost of the entire server and all dockers going to crap.

Hardware:
I had several old parts from another build that was decommissioned and I decided to give this build a shot. I bought a 2u rose will server chassis and built in the following components:

  • asus prime b360m-a microatx mobo
  • Corsair vengeance 2x8gb ddr4 ram
  • crucial 512gb m.2 ssd drive
  • intel core i5 8400 cpu
  • cooler, psu, fans, and whatever else I needed were used to complete this build.
  • total spent $280

Setup:

  • Ubuntu desktop
  • Plex from the Ubuntu store
  • mounted shares from unraid setup as described by jdm above … (by the way, if your unraid share had a space in the name, while trying to mount your share, use “\040” in place of the space. e.g., “tv show” will be “tv\040show”
  • all metadata moved to new server which took like 20 hours and stored on NVMe.

Results:

  • 26 simultaneous transcodes
  • ~50-60% max CPU utilization at this transcode load

Conclusion:

  • build this ASAP! Or actually buy a cheap box ad outlined. It’s a no brainer to offload your main server.

Pics attached

6 Likes

Maybe I missed it, but don’t forget if you have an abundance of RAM you can set the temp transcode directory to /dev/shm/ in ubuntu to use RAM instead of your root drive. Changing that increased my 4K transcoding to 25x and fills the 300s buffer in 1-2 seconds.

You absolutely can transcode in RAM, but I still wouldn’t recommend transcoding 4K!

Great point. I’ve transcoded before in my main server using ram but didn’t notice a major performance boost. But that said, it’s been a while. My new server only has 16gb so don’t think that’ll be enough. Thoughts?

Yes no doubt, I transcode 4K only to tax the system. The amount of 1080p transcodes you have to do to test a system is a pita. There is an app idea though, one click to start a specified number of random streams.

I need to be able to transcode 4K (even with washed out colors) for the random end users who may not play original. I used to just not share my 4K library but my family all have 4K tv’s now and Marvel movies should be witnessed in 4K. I really wish plex would allow me to just specify per user the ability to limit transcodes.

Plex has a new Transcoder preview out that officially supports Nvidia enc/dec on Linux.

image

Looks to be working, although the hack performed a bit faster as my transcode speed was 22x-25x before

image

image

You’re not able to in plex but if you use tautulli you can load up some funky scripts that might let you limit your users from going too crazy. I spent some time setting up kill streams so that tautulli would kill any transcode of any file that was above a certain size that was transcoded down to 4 mbps. You can also set up automated custom messages so users know why you killed their stream.