Proxmox: Install Plex LXC with HW Transcoding/HDR Tone Mapping

In this post I cover how to setup a Plex Media Server (PMS) LXC on Proxmox with hardware transcoding and HDR tone mapping. Contrary to popular belief, the Plex LXC does not need to be configured with PCIe passthrough for the GPU. So NO Proxmox IOMMU host configuration is needed to allow the Plex LXC to do hardware transcoding and HDR tone mapping. This procedure uses the awesome tteck Promox Plex LXC script to mostly automate the setup of a Plex LXC with the needed GPU drivers and LXC configuration to enable these GPU offload features.

Update May 19, 2024: Clarified Privileged vs. Unprivileged LXC container, depending on if you need to use a NFS mount for your media. 

Update May 4, 2024: Updated content with current information regarding drivers, Proxmox version, and more. Situation is much better today with pretty much seamless support for Alder Lake CPUs. Updated some information for Proxmox 8.2, and tteck’s new unprivileged Plex LXC script. 

Update April 22, 2023: GPU PCIe passthrough is NOT needed for the Plex LXC. So no Proxmox host configuration with VT-d or IOMMU is needed. I have removed those sections from this post to avoid confusion.

Hardware Transcoding and HDR Tone Mapping

Getting Plex hardware transcoding and HDR tone mapping to work requires two components: 1) The Plex LXC GPU drivers for your Proxmox host GPU. In my case, Intel GPU drivers for Ubuntu 22.04 (the LXC OS) and Alder Lake 2) Plex Media Server (PMS) built-in media drivers that support your specific GPU. The PMS media drivers are not something you have any control over. They are baked into PMS. Getting both driver stacks to support your GPU can be challenging for both hardware transcoding and HDR tone mapping. This is mostly a potential problem on very new generation Intel CPUs. I have not tested 13th or 14th Gen, but 12th Gen seems very stable now.

Synology Migration Guide (Optional)

If you want to migrate your Plex Media Server that is running on your Synology NAS (while leaving your media library on the Synology) to a Plex Server LXC, you can check out my post: Migration Guide: Plex on Synology to Proxmox LXC. Before you go through that post, follow this one in its entirety to verify hardware transcoding works. After which you can then migrate your PMS configuration to the Plex LXC, and access your media library on the Synology via NFS.

My Setup

I validated this setup on two different Beelink mini-PCs. The SEi12 Pro has an Alder Lake i5-1240P (12 cores, 16 threads), and the Beelink Mini S12 Pro has an Alder Lake N305 (4 cores, 8 threads). 

Setup Details:

Beelink SEi12 Pro Mini PC, 12th Gen Intel Core i5-1240P
Beelink Mini S12 Pro, 12th Gen Intel N100
Proxmox 8.2
Proxmox Kernel 6.5.13-5
Ubuntu 22.04 LXC Image with Plex (from tteck)

I suggest sticking with Ubuntu 22.04 as the LXC OS. That’s what I tested and I know it works. Newer or older versions may have Intel driver support issues, so use at your own risk. The latest 6.5.x Linux kernels have the best Alder Lake support, so that’s why I used Proxmox 8.1 (or later).

Installing Proxmox

If you already have Proxmox installed, you can skip this section and go to the Proxmox GPU Verification section below. 

I wrote an in-depth Proxmox installation guide that included a Home Assistant section. We can re-use most of that content and just skip the sections applicable to Home Assistant. Click on that link and open in another window. For the purposes of a Plex LXC with GPU transcoding, follow these sections in my Proxmox VE 8.2 Quick Start Guide:

  1. Proxmox Storage Recommendations
  2. Creating Proxmox USB Boot Media
  3. Installing Proxmox VE 8.2
  4. Proxmox Post Install Configuration

Any other sections in my post like CPU power optimization, SMART monitoring, VLAN enable, and SSL cert are optional and have no impact on the Plex LXC. 

Proxmox GPU Verification

Although the Plex LXC doesn’t need PCIe/GPU passthrough, we can verify that Proxmox recognizes the GPU and get the model number. In the Proxmox UI click on your host in the left pane and in the middle pane click on Shell. Enter the following command to find the VGA adapter:

				
					lspci -v | grep -e VGA
				
			

Here we can see I have an Intel GPU at PCIe address 00:02.0

Let’s get more details about that VGA adapter:

				
					lspci -v -s 00:02.0
				
			

Now that we know Proxmox recognizes the GPU and has a kernel driver, let’s deploy the Plex LXC.

Plex LXC Installation

  1. Login to Proxmox and select your Proxmox server in the left pane.
  2. Click on Shell in the middle pane.
  3. Enter the following command to start the Plex LXC install via the tteck script. Press Enter on Yes.
				
					bash -c "$(wget -qLO - https://github.com/tteck/Proxmox/raw/main/ct/plex.sh)"

				
			

4. Select Advanced.

5. Select Ubuntu then select 22.04 Jammy.

6. Change CONTAINER TYPE. If you (ever) need to mount your media via NFS, you MUST select Privileged. If you will be using Samba/SMB or have local media only, you can select Unprivileged (only Proxmox 8.2 and later). Note: You can’t change the privilege level after deployment. You will need to deploy a new LXC and then migrate your Plex metadata to the new LXC instance. Unprivileged is better from a security perspective, but blocks NFS mounts.  

7. Enter a complex password.
8. Accept the container ID.
9. Set the Hostname.
10. Change the Disk Size as needed. Note: I’d go for 16GB minimum.
11. Change Core Count as needed. Note: I’d recommend starting with 2-4 cores.
12. Change RAM as needed. Note: Plex is light on memory usage, so even 1024MB should be plenty.
13. Leave the Bridge.
14. Optionally set a static IP (e.g. 192.168.10.45/24). Note: Strongly recommended to use static IP.
15. Set a Gateway IP.
16. Leave APT-Cacher IP blank
17. Don’t disable IPv6 (unless you need to).
18. Leave MTU Size blank.
19. Set DNS Search Domain (if needed).
20. Set a DNS server IP.
21. Leave the MAC address blank.
22. Leave the VLAN.
23. Enable Root SSH access.

23. Don’t enable verbose mode.
24. Press enter on Yes, Create Plex LXC.
25. Select your storage by using the arrow keys, then press space to select, and tab to OK.
26. Again, select the storage you want to use.
27. Wait for the OS to download and update. Make take a few minutes. DO NOT do ANYTHING in the Proxmox console during the install. Wait for the Plex should be reachable message. 

Note: tteck’s Plex LXC installer downloads and installs a number of libraries needed for hardware GPU acceleration. So you might see other guides on the internet that manually install several packages. Those steps can be skipped with his Plex LXC script.

Plex LXC Driver Verification

1. Let’s verify that the Ubuntu Plex LXC sees the GPU. SSH into the Plex LXC container and run the command below. Look for at least one renderD entry.

				
					ls -l /dev/dri
				
			

2. Tteck’s Plex LXC deployment script automatically installs the latest hardware acceleration packages (i.e. Intel drivers). So no need to do any wget commands to install those drivers. Run the command below and verify Plex recognizes your specific GPU model.

				
					cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Logs 
more Plex\ Media\ Server.log | grep dri
				
			
Plex Logs showing Alder Lake GPU

Verify Transcoding

If you want to migrate from Plex Media Server on Synology to Plex LXC, while maintaining your media library on the Synology, check out my post Migration Guide: Plex on Synology to Proxmox LXC. This section assumes you have either done a PMS migration (from any platform), or created a new media library with at least one high-res video clip to test cellular transcoding. I’ll assume you know enough about about Plex to configure that yourself.

1. In order to test if transcoding is working, it’s easiest to setup inbound internet access to your Plex server and then use a device like a phone on a cellular connection (NOT WiFi) to stream media and verify Plex is hardware transcoding. Once you are at the Plex main dashboard, click on Remote Access in the left pane.

2. On your router configure port forwarding and setup remote access within Plex. Verify that Plex shows your server is accessible outside your network.
3. In the left pane click on Transcoder. Ensure the tick the box next to Use hardware acceleration when available is checked. Use hardware-accelerated video encoding should be checked as well.

4. If you do enable HDR tone mapping and the video is not smooth, run the command below to look for errors related to OpenCL, such as: Failed to get number of OpenCL platforms: -1001. You may need to wait for an updated Plex Intel graphics driver as previously mentioned. Until then, disable HDR tone mapping.

				
					more "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log" | grep ERROR
				
			

5. Take your phone and turn off WiFi. Launch the Plex player on your phone and start watching a video.

Tip: You can download a 1GB HDR test video from this LG Site. Put the video in your library and play it as a good test.

In the Plex dashboard it should show hw transcoding. Even with hardware transcoding, you may see a Plex LXC CPU spike when you start playing media. I was testing with a 2 vCPU LXC container and for a few minutes when I started a movie the CPU hovered around 60%. Then it leveled off between 1% and 13%. 

Hardware Transcoding is Active

Summary

Getting hardware transcoding to work on a Plex LXC on Proxmox is pretty easy with tteck’s awesome Plex LXC script. No GPU or PCIe passthrough is needed. And with Proxmox 8.2 and tteck’s latest script, the LXC container can use hardware transcoding resources as an unprivileged container. 

Print Friendly, PDF & Email

Related Posts

Subscribe
Notify of
25 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
budley
June 14, 2023 5:51 am

I’m new to Linux and Proxmox, so for the past month I’ve been struggling through successes and failures with VMs and LXCs at an alarming rate. (I’ve reinstalled Proxmox at least 7 times now in the past week alone.) Your blog is a godsend and very much appreciated. Many thanks!

Shetu
July 4, 2023 10:59 am

Hi
I stuck at this point. Prxmpx 8, Cpu i5-8400
unable to open file ‘/var/lib/pve-manager/apl-info/releases.turnkeylinux.org’ – No such file or directory
 – Downloading LXC Template…unable to open file ‘/var/lib/pve-manager/apl-info/releases.turnkeylinux.org’ – No such file or directory

Dyfinder1
July 8, 2023 12:55 pm

Hi Derek,
If you could make a note for people, I followed this guide and ran into an issue where I couldn’t get HW to work after following this guide perfectly. To get HW transcoding to work, I had to downgrade my plex media server installation from the latest built to plexmediaserver_1.32.0.6918-6f393eda1_amd64.deb
I got this version from https://github.com/axlecrusher/plex_download_urls/blob/master/archives/linux-x86_64.debian.md
Regardless, I hope this comment helps any who came across this issue as well 🙂

Miguel
July 31, 2023 2:51 pm

Hi, excellent guide! But i have a problem, in my plex interface don´t have this options:
Use hardware acceleration when available
Enable HDR tone mapping

The plex version that i use is: 1.32.5.7349

All movies that i reproduce appear as:
Video: transcode [hevc -> h264]
Audio: transcode [aac -> aac]

Thanks for your comments

Juozis
August 3, 2023 12:50 am

Why do you use privileged container? Doesn’t it expose security risk?

Allistaah
August 6, 2023 8:01 pm

How do you update the Plex server that was installed with this script?

myreal
September 2, 2023 12:04 am

Hey,

I’ve installed Plex LXC with tteck script previously, hardware transcoding worked fine. Then I followed this guide: https://www.derekseaman.com/2023/06/proxmox-ve-8-windows-11-vgpu-vt-d-passthrough-with-intel-alder-lake.html, which worked out perfect, but then broke Plex HW transcoding. Any ideas what should I adjust in Plex LXC?

I’m on 12700 (alder lake).

Dyfinder
September 19, 2023 6:52 pm
Reply to  Derek Seaman

Do you know of a fix or a workaround? Disabling HDR Tone Mapping kills the saturation

elvasilep
September 23, 2023 1:48 pm

Hi,

I followed the instructions exactly to install Plex MS on LXC on Proxmox 8 on Celeron N5105 (Jasper Lake). All the diver visibility test passed, including Plex actually identifying it as Jasper Lake CPU. Unfortunately no hw xcoding 🙁

However, after adding “intel_iommu=on iommu=pt i915.enable_guc=2″ in the grub GRUB_CMDLINE_LINUX_DEFAULT and “vfio
vfio_iommu_type1 vfio_pci vfio_virqfd” in /etc/modules on the host, as documented in many of the internet related entries, hw xcoding started working :-)))

The tteck scripts are awesome though. Thanks for pointing them out.

Rikusj
October 5, 2023 2:47 am

I would like to install plex using your guide (used your proxmox / HA guides previously with great success).

My proxmos server has a 4tb SATA drive installed. How would you suggest I make the drive available for Plex in a way that it can also be accessed by Sonarr and via windows 11 as a network share?

Thanks!

MilesTEG
March 6, 2024 9:02 am

Hello,
I’ve got a NUC with an AMD Ryzen™ 9 7940HS with iGPU AMD 780M.
Do you think it’ll be possible to get HW transcode with this iGPU ?

Landry
April 4, 2024 11:58 pm

Thank you this is amazing. I have one issue. Trying to auto mount NFS parition on boot using fstab. however the fstab file says its unconifgured, and seems to ignore the line i added to auto mount. Is there a way i can auto mount this NFS when the server reboots?

Landry
April 7, 2024 10:35 am
Reply to  Landry

I have since resolved this issue. Thanks!

Landry
April 5, 2024 12:14 am

My previous issue with automounting NFS has been resolved but Everytime i reboot my server Plex says “server is unclaimed and not secure” then i have to click claim it now and wait for it to load. I read this is from having plex’s config files in a temp folder. any way to get around this/make it go away?

Landry
April 7, 2024 10:36 am
Reply to  Landry

I have resolved this issue. Had to delete all the non directory files in the /Cache folder within Plex’s directory. Not sure why but that fixed it

lollo
April 20, 2024 1:03 am

Hi, are there news about 12th and 13th Alder Lake N support for media driver?

Miles
May 4, 2024 12:23 pm
Reply to  lollo

Hello,
I would be grateful if there’ll be an answer to this question.

Miles
May 4, 2024 12:25 pm

Hello,
Is this guide can be applied to Proxmox 8.2 ?

And can I create several (2 minimum) LXC container using the iGPU? Will it works?

Thanks for your guides!

Hai Doan
May 6, 2024 9:54 pm

I’m in the boat of users with the OpenCL errors when Tone mapping is enabled. Looks like it is getting some traction.

https://forums.plex.tv/t/ubuntu-24-04-hw-transcoding/873765/40

Hai Doan
June 11, 2024 12:44 am

Tonemapping is working now with the 6.8 kernel and PMS 1.40.3.8555

pve
June 21, 2024 11:48 am

Why not use Ubuntu 24.04 ?