Hardware transcoding is one of my favorite features of my media server, which is powered by Plex.It allows me to have one copy of a movie on it and then simply transcodes it into any container or format it needs.However, it took me a while to get it working properly with Docker.
Hardware transcoding is what makes Plex servers powerful Though Plex Pass is needed to use your hardware’s most powerful transcoding engines If you plan to just run a standard Plex server with no transcoding (or just transcoding on your processor), then that’s a setup that is hard to break.However, if you want to leverage hardware transcoding, things get a bit trickier.Hardware transcoding is the secret sauce to any media server—but it does require an active Plex Pass membership to use.
It’s what allows you to have a 1080p movie and downsample it to 720p on a bad network.Or, have a 4K HDR copy of a movie, and stream it to a 1080p TV or even your phone while outside of the house.With hardware transcoding, Plex is able to utilize the native media engines of whatever processor or graphics card your system has instead of just making your CPU brute-force the transcode.
Think of your processor’s normal CPU cores like a butter knife.Very versatile, but might be slow to do precise tasks.The media encoding engines on your CPU or GPU are like a fillet knife—precise and accurate, but really only useful for a handful of things.
So, having your Plex server set up to use the hardware transcoding features of your system is crucial to a proper Plex setup.Passing your GPU into Docker is where most Plex setups break If the device isn’t mapped correctly, Plex can’t use hardware transcoding Passing a GPU through to Plex in Docker is either very simple or surprisingly frustrating, depending on your setup.My original Plex server was pretty easy to handle, I had a GPU dedicated to Plex, so I was able to pass it through to Docker and it worked just fine.
Then, I moved to a system running Proxmox and wanted to use the iGPU for Plex.This was pretty difficult to set up, as I had to pass the iGPU through from the host OS (Proxmox) to a virtual machine (Ubuntu) and then to the Docker container.Now, I run Plex on my NAS, which has an iGPU that I use for Plex, and setup there was very straightforward and easy.
There’s no way for me to cover all potential setups here, but what I will do is tell you what to do once you get the iGPU or graphics card visible by Docker itself—whether that’s inside of a VM or just on your host system.If you’re using a NVIDIA GPU, then using it in Plex is pretty simple.Just make sure Docker has access (typically through the NVIDIA Container Toolkit), and add the following two lines to your environment variables: environment: - NVIDIA_VISIBLE_DEVICES=all - NVIDIA_DRIVER_CAPABILITIES=compute,video,utility Using an Intel device for your graphics card takes a few more lines, but it’s still pretty simple to do: environment: - LIBVA_DRIVER_NAME=iHD - VAAPI_DEVICE=/dev/dri/renderD128 - PLEX_HWTRANSCODE=1 devices: - /dev/dri/card0:/dev/dri/card0 - /dev/dri/renderD128:/dev/dri/renderD128 Of course, you need to integrate these lines with any other environment variables or devices that you have mounted with Plex, and make sure that your volumes are mounted properly.
But, really, all that’s needed to use an NVIDIA GPU or Intel iGPU is the above variables.Depending on what host you’re running your Docker setup on, you might not even need to make the manual edits.For example, my Ugreen NAS has a toggle when creating a new Docker container that handles GPU passthrough automatically, and it works well.
Other systems offer similar functionality if you poke around, but you do sometimes still need to set the environment variables specific to the container you’re running.Always verify that Plex actually detects your GPU The proof is in the pudding Passing the transcoding device through to Plex is great, but that doesn’t mean Plex is actually using it.When I was passing my iGPU through the VM to Plex, it took a handful of attempts to get Plex to properly see and use it.
So, any time I set up a new Plex server with hardware transcoding, I always verify it’s working before calling the job done.It’s entirely possible to start a stream and look for (hw) when transcoding, but I normally head to Settings → Transcoder → Hardware transcoding device.This should show the specific device you have for transcoding, but if it’s empty or says “Auto” with nothing else in the dropdown, then there’s a good chance your passthrough isn’t working properly.
I typically start by verifying the transcoding settings, but then I always like to double verify by doing a transcoded stream and look for the (hw) tag on it to make sure that it’s properly transcoding using the dedicated hardware.KAMRUI Hyper H2 Mini PC Brand KAMURI CPU i5-14450HX The KAMRUI Hyper H2 Mini PC features an Intel Core i5-14450HX 10-core 16-thread processor and 16GB of DDR4 RAM.The included 512GB NVMe SSD comes with Windows 11 pre-installed so the system is ready to go out of the box.
$479 at Amazon Expand Collapse Plex Brand Plex Free trial Free version available With Plex, you can keep a single, unified Watchlist for any movie or TV show you hear about, on any service—even theater releases! You can finally stop hopping between watchlists on all your other streaming services, and add it all on Plex instead.Get started for free Expand Collapse If you don’t get hardware transcoding working, then your CPU shoulders all the transcoding responsibility Hardware transcoding might seem like a trivial thing to worry about, but it can steal precious resources away from your processor for other tasks.If you have a powerful system running Plex, then you might not notice transcoding happening on the CPU.
But, if you have a lower-power device, like an Intel N95 or N100 mini PC, then transcoding on the CPU could bring the system to its knees, slowing everything else down in the process.So, make sure you have your Plex server properly handling hardware transcoding.Your processor will thank you.
Read More