In this tutorial, we will be showing you how to install the official Plex Media Player to the Raspberry Pi.
Using the Plex Media Player, you will be able to play media files delivered from your Plex Media Server.
One of the most significant advantages of Plex is that it can transcode video files to your devices. Transcoding allows even a device like the Raspberry Pi to play a vast range of video files.
While RasPlex is often the go-to method for getting a Plex client on the Raspberry Pi, it has no support for the Raspberry Pi 4.
There are advantages to making use of the Plex Media Player over the alternatives like RasPlex and PlexKodiConnect. These advantages include access to all of the latest Plex features as soon as they are implemented.
However, the downside is that the Media Player is a lot more resource-intensive, and you will need to compile it yourself.
Please note that before you start this tutorial, you need to use a Raspberry Pi 4 for optimal performance. If you are using an older Raspberry Pi, we recommend that you use either PlexKodiConnect or RasPlex.
Warning, Plex have completely dropped support for the Plex Media Player code base. It is now in archived mode meaning no fixes will be pushed to the repository.
Equipment List
Below is the list of equipment that you will need to get your Raspberry Pi powered Plex client up and running.
Recommended
- Raspberry Pi ( Amazon ) 4
- Micro SD Card ( Amazon )
- Power Supply ( Amazon )
- Ethernet Cable ( Amazon ) or Wi-Fi ( Amazon )
- HDMI Cable ( Amazon )
- Monitor ( Amazon )
Optional
For this tutorial on setting up the Plex Media Player, we were using a Raspberry Pi 4 running the latest available version of Raspberry Pi OS Desktop (Bullseye).
Preparing to Compile the Plex Media Player, on the Raspberry Pi
In this section we will be preparing your Raspberry Pi to compile the Plex Media Player software.
Before you begin, you need to make sure you are running a version of the Raspberry Pi OS that features a desktop interface. We recommend that you use the version that does not come with the recommended packages.
1. Warning: Plex has discontinued support for the Plex Media Player code base. The repository is archived, which means no further updates will be made. This tutorial is kept online for archive purposes only.
Our first task is to make sure all of our packages are up to date.
We can achieve this by running the following two commands.
sudo apt update
sudo apt full-upgrade
2. Our next task is to ensure all the packages we need for the following sections exist on the operating system.
Run the following command to install all the required packages.
sudo apt install -y autoconf make automake build-essential gperf yasm gnutls-dev libv4l-dev checkinstall libtool libtool-bin libxslt1-dev libre2-9 libminizip1 libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libcec-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libbluray-dev libdvdread-dev libcdio-paranoia-dev libsmbclient-dev libcdio-cdda-dev libjpeg-dev libluajit-5.1-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libgles2-mesa-dev libsdl2-dev cmake python3 python3-pip python git mpv libmpv-dev
There is quite a large number of packages to install, so this process may take some time.
3. Once the installation process completes, we can utilize the Python 3 package manager called “pip” to install a newer version of Meson and Ninja than is available through the package repository.
To install the Meson and Ninja Python packages, you will need to run the command below.
sudo pip3 install meson ninja
Compiling MPV on the Raspberry Pi
One of the requirements to compile the Plex Media Player on your Raspberry Pi is to have the mpv libraries.
In this section, we will be walking you through the steps to get MPV compiled.
1. We first need to clone the MPV master branch to our Raspberry Pi by running the following command.
git clone https://github.com/mpv-player/mpv-build.git
2. Next, we need to change into the newly cloned directory. You can change in to this directory by using the command below.
cd mpv-build
3. Before we compile mpv, we will need to make some changes to its configuration options.
We can do this by adding two lines to the mpv_options
file.
Run the following two commands to adjust the compilation options.
echo --enable-libmpv-shared > mpv_options
echo --disable-cplayer >> mpv_options
echo --extra-libs="-latomic" >> ffmpeg_options
The first command adds an option telling it to compile the shared MPV libraries.
The second command disables the command line interface for MPV as we don’t need that for the Plex Media Player.
4. The last thing we are required to do is to tell the build scripts to use the release versions of MPV, FFMPEG and libplacebo.
We can achieve this by running the following three commands.
./use-mpv-release
./use-ffmpeg-release
./use-libplacebo-release
5. Start the compilation process by using the following command within the terminal.
BUILDSYSTEM=waf ./rebuild -j$(nproc)
By using $(nproc)
we are telling it to use as many jobs as we have processes. For the Raspberry Pi 4, this will be four active jobs.
Please note that this process can take considerable time to complete. It has to clone and compile FFMPEG, MPV and libplacebo on your Pi.
6. Once the compilation process has completed, we can now install the libraries to our Raspberry Pi’s operating system.
To achieve this, we just need to run the command below.
sudo BUILDSYSTEM=waf ./install
7. Finally, run the following command so that the operating system knows there are new libraries it needs to link to.
sudo ldconfig
Obtaining QT for the Raspberry Pi
In this section, we will be getting our last required component for the Plex client.
This component is the Qt library. This library is used to drive the graphical interface of the Plex Media Player. As we need Qt to have been compiled with the web engine library we can’t use the package available through the repository.
1. Luckily, we have provided a pre-compiled version of this package that has everything you need to compile the player.
You can download Qt to your Raspberry Pi by using one of the following wget command‘s within the terminal.
If you are using a 32-bit version of Raspberry Pi OS then run the command under step A. If you are using a 64-bit version of Raspberry Pi OS, follow step B.
A. Use the command below to download the 32-bit version of QT for the Pi.
wget https://files.pimylifeup.com/plexmediaplayer/qt5-opengl-dev-nobrcm_5.15.2_armhf.deb -O qt5-opengl-dev-nobrcm_5.15.2.deb
B. The command below will download the 64-bit release of Qt to your Pi.
wget https://files.pimylifeup.com/plexmediaplayer/qt5-opengl-dev-nobrcm_5.15.2_arm64.deb -O qt5-opengl-dev-nobrcm_5.15.2.deb
2. We can install the package that we just downloaded by running the following command.
As we no longer need the package after installing it, we will also be deleting it.
sudo apt install -y ./qt5-opengl-dev-nobrcm_5.15.2.deb
sudo apt --fix-broken install
rm qt5-opengl-dev-nobrcm_5.15.2.deb
At this point, you should now have QT and mpv installed to your Raspberry Pi.
Compiling the Plex Media Player on a Raspberry Pi
With everything now set up, we can clone and compile the Plex Media Player to our Raspberry Pi.
1. Let us start by making sure we are currently in our home directory.
We can change to the home directory by running the command below.
cd ~
The tilde (~
) is used as a reference to the home directory.
2. Now clone the Plex Media Player repository to your Raspberry Pi by using the command below.
git clone https://github.com/plexinc/plex-media-player
3. To compile the Plex client we need to make a build
directory for it.
Create this directory and change into it by running the following two commands.
mkdir ~/plex-media-player/build
cd ~/plex-media-player/build
4. We can now use CMake to configure the source code for compilation.
cmake -DCMAKE_BUILD_TYPE=Debug -DQTROOT=/opt/Qt/5.15.2/ -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
CMake will auto-detect features that it can enable or disable for our Raspberry Pi.
5. Now let us compile the Plex Media Player by using the following command.
make -j$(nproc)
Please note that on older Raspberry Pi’s, this process may take some time. Using a Raspberry Pi 4, this process only took us about 5 minutes.
6. Our final task is to install the freshly compiled binaries to our operating system.
We can achieve that by making use of the following command.
sudo make install
Opening the Plex Media Player
To open the Plex Media Player on your Raspberry Pi, you will need to make use of the terminal.
1. Within a terminal session on your Raspberry Pi, run the following command to open the Plex Media Player.
To avoid a potential crash that can occur, we will be disabling the Qt’s web engine sandbox by setting the “QTWEBENGINE_DISABLE_SANDBOX
” environment variable to 1
.
QTWEBENGINE_DISABLE_SANDBOX=1 plexmediaplayer --fullscreen --tv
This command will launch the software in full-screen mode on your device.
2. You should now be able to log in to your Plex account and gain access to your Plex library.
You should now have the Plex Media Player up and running on your Raspberry Pi.
Starting the Plex Media Player on Start Up
Now that you have the Plex Media Player installed on your Raspberry Pi, you will probably also want it to start at boot on your device.
1. Before we can get started, we need to create a directory to store our configuration file.
This directory may exist already, but it doesn’t hurt to run the following command anyway.
mkdir -p /home/$USER/.config/autostart
The current users name is stored within the “$USER
” environment variable. If you are setting this up for a different user then replace “$USER
” with their name.
2. To get the Plex Media Player to start at startup, we will need to create a special “.desktop
” file within the folder we just created.
This file will be automatically interpreted when the operating system starts up the desktop interface.
Begin writing this file by running the following command on your Raspberry Pi.
nano /home/$USER/.config/autostart/plexmediaplayer.desktop
3. Within this file, you will need to add the following lines.
[Desktop Entry]
Type=Application
Name=Plex Media Player
Exec=env QTWEBENGINE_DISABLE_SANDBOX=1 plexmediaplayer --fullscreen --tv
These lines are pretty straightforward and define the application we want auto-started. Using the “exec
” option, we are telling it to run the Plex Media Player.
4. Once you have added these lines into this new file, you can save and quit by pressing CTRL + X, then Y, followed by the ENTER key.
5. Our next step is to ensure that your Raspberry Pi will boot directly to start up without requiring to be logged in.
To easily modify this setting, we can use the Raspberry Pi Configuration tool. This tool is installed by default on all versions of Raspberry Pi OS.
sudo raspi-config
You can navigate this menu using the ARROW keys. When you want to select an option, you can press the ENTER key.
6. Within the config tool, change to the “System Options
” menu. At the time of writing, this is the first option.
Next, you will need to select the “Boot / Auto Login
” menu.
Finally, select the “Desktop Autologin
” option. This option will allow your Pi to boot directly to the desktop without requiring you to login.
7. At this point, your Pi should be set to run the Plex Media Player at startup.
You can verify that this is working at startup by restarting your Raspberry Pi.
sudo reboot
Conclusion
At this point, you should now have the Plex Media Player running on your Raspberry Pi.
The Plex Media Player is a reasonably resource-intensive player but is one of the best ways of viewing Plex content on your Pi.
As we compile the official source code, it means you will have access to the latest features as they are pushed to the official repository.
If you have any issues with getting this set up on your Pi, feel free to leave a comment below.
Also, be sure to check out some of our other Raspberry Pi media projects.
Great guide! I’m following these instructions in late February 2022 on a new Pi 4 4GB running 64-bit Raspberry Pi OS.
Everything went well until the compile – at 98% I start to get a slew of errors! I’m not sure what impact the ld.gold errors are having, but the zillions of undefined reference messages are surely showstoppers. I cannot find a good solution anywhere — any advice?
Here’s the output — I trimmed off the hundreds of other “undefined reference” error messages:
Hi Simon,
There is a couple of things going on here, both are related to the qt library build that we are using.
First, the compiled version we are using is not compatible with changes introduced by newer releases of Raspberry Pi OS Bullseye. The last supported release for this library was Raspberry Pi Buster.
Secondly, the library was compiled for 32-bit systems, so its incompatible with the 64-bit operating system.
Cheers,
Emmet
That explains everything — thanks!
Hi Emmet,
Love this tutorial, but when I tried to install it I ran into the same problem as Brian K Isom on December 29.
Do you have a solution for it or do I have to go back to Buster.
Regards,
Geert
Hi Geert,
Sadly you will need to roll back to buster for the time being. Still haven’t found a suitable workaround.
Cheers,
Emmet
Hello Emmet,
First I would just like to thank you for this tutorial! Love my Plex server but am looking for a better player. I have a Pi 4 and am running into this issue when I run
cmake -DCMAKE_BUILD_TYPE=Debug -DQTROOT=/usr/lib/qt5.12/ -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
So when I run “
make -j$(nproc)
” i get “make: *** No targets specified and no makefile found. Stop.
”Any help would be much appreciated!!!!
Hi Brian,
Thank you for reporting this issue. I am now looking into this issue.
The error you are running into has to do with the QT Library that we install during the tutorial being compiled with broadcom EGL support. Broadcom EGL was replaced in the latest version of Raspberry Pi OS.
In the mean time using Raspberry Pi OS Buster will allow you to work around this problem.
Cheers,
Emmet
Did you ever solve this problem??
Hi Matt,
I just updated the tutorial with a freshly compiled version of Qt. You should now be able to compile and run Plex Media Player on Raspberry Pi OS Bullseye (32-bit).
Hopefully will be able to update the tutorial with 64-bit support in the next couple of days.
Cheers,
Emmet
Emmet, that’s great news about the Bullseye update on 32-bit and the upcoming update on 64-bit, thanks for continuing to support and improve this tutorial! I’ve been running the “original” version on Buster after our last chats and have been really happy with it, and the family is thrilled that I ditched Kodi for something that “just works” for them (and on their own devices as well).
Thank you Emmet,
I can’t believe you are still responding to questions here. I sent that not expecting a response.
Your fix resolved my problems until I try to run this command:
And get this response:
Even when I try to run Plex from the GUI it tries to start but never actually opens. I’m not quite sure what to do to fix this. Any help would be appreciated.
Hi Matt and cbarn,
We are always glad to ensure that our tutorials to continue to work on newer releases, and its nice to see when people continue to find these guides useful.
Now on to the problems you are having Matt. Looks like the changes came with a new package requirement that we aren’t currently installing within the guide.
Can you please try installing the libre2 library to your Pi by running the command below. That should hopefully be the only one missing.
Cheers,
Emmet
Emmet,
The libre2-9 package helped but then I was missing libminizip.so.1 which I used this command to get:
sudo apt-get update
sudo apt-get install libminizip1
Now my app is up and running. Thank you again for the help and continued support. Without you I couldn’t have Plex running 4k on my new Pi.
Hi Matt,
Awesome, thank you for getting back to me with that missing package. I’ll now update the tutorial so they will both be installed during the process.
I am glad to hear that you now have it up and running on your Raspberry Pi!
Cheers,
Emmet
Hi Matt and cbarn,
Following up from my previous comments, finally finished compiling Qt for 64-bit ARM systems.
So Plex Media Player should now be able to be compiled and ran on a Raspberry Pi running the 64-bit release.
Cheers,
Emmet
Thanks Emmet, I’ll try to give it a whirl this weekend!
Have you noticed any significant performance differences between the 64-bit and 32-bit versions (or running on Bullseye in general)?
Emmet,
Thank you for the update. I’m going to try the 64-bit version to see if it runs better. Right now, the 32-bit version is a slideshow no matter what I try to play. Even the menu is laggy and stuttering. I’m trying to troubleshoot to verify if its the plex client settings or this version of plex.
My Pi 3B+ running plex embedded works flawlessly and I would love to find (or learn how to make) an embedded version for the Pi 4. If you know anything about making an embedded version I would be very interested to discuss it.
I’ve been using Rasplex for years on 3 pi devices. Two have HifiBerry as well. Rasplex was the only option at the time that had gap less playback. It also worked very well. Unfortunately, it hasn’t been supported in years and the software march onward has taken it’s toll. I started getting errors that ‘server could not create playback queue’. A server and Plex upgrade resolved the issue for a couple of weeks but then it returned. I decided to see if there was a better option. I tried both Plex plugins on KODI. I could not get PlexBMC to work at all. The other plugin worked but you couldn’t cast to the player which is a deal breaker for me. I also tried the Plex embedded player. Could not get that to work at all either. So, luckily I found this page. It works great as a music player. It’s jerky for video. Not sure why. For anyone else trying this, make sure that you install Raspbian Buster. I initially downloaded the wrong one and had issues. Other than the video issue, I’m very pleased that I migrated to Raspbian with the Plex media player
How to remove plex autostart on raspberry pi boot?
Hi Dercio,
You only need to delete the file that we created during the tutorial.
Cheers,
Emmet
I followed these instructions a couple of months ago and it all appeared to work well.
The one issue I haven’t been able to figure out yet is it plays HD content with fantastic quality but blue screens after 15mins. A reboot and it does another 15mins before blue screening again.
I have wiped and reinstalled everything from scratch and it is still happening – next stop is to try a different SD card.
Going to follow this guide in 2021, any big changes in the last 12 months that make this a bad idea? In addition how do people get remotes to work? does it just work with TV remote via HDMI?
Hi David,
I tested this tutorial relatively recently and it all still appears to be working. Of course it still isn’t the best experience if you throw very high definition files at it.
I however, have never tested this with a remote using HDMI-CEC. Please let me know how you get on if you decide to give it a try.
Cheers,
Emmet
did do Gene Latham’s script in auto start, @ reboot is askimg me for a passwor, do enter default password (because i did not change the stock password) and is stuck there, any sugestions
Hi JC,
I updated the tutorial with new steps for getting Plex Media Player to start at boot, please give them a try.
Cheers,
Emmet
I installed Plex on a Raspberry Pi 4 using the above process and it all worked fine – however, the image quality isn’t great for 1080p videos. I get horizontal misalignment and some pixellation in the image especially during fast moving sequences. I also have Plex installed on some laptops and a couple of Smart TVs and I don’t have any problems playing the same files on them. I have also tried the Pi on both an HD PC screen (via HDMI) and on a project (via HDMI) and I have the same problems.
I have increased the graphics memory to 132Mb and I have pushed the clock rate of the processor and the GPU, but none of these have made any difference.
Has anyone had the same issues? Can anyone suggest a solution?
I got an error building ffmpeg. Looking up the error (undefined reference to `__atomic_store_8′)
I added the following option to ffmpeg_options:
echo --extra-ldflags="-latomic" >> ffmpeg_options
I hope this helps the next person with this error.
Hi, it really helped, though I had to remove the “”s, like this:
Thanks! Got that one too. Note for anyone else needing to run this — the commenting system converted the double-quotes into smart quotes, so you’ll need to replace them with normal ones — or indeed, like Scepi did, just miss them out, because they’re not strictly necessary.
This no longer works. You need to add execute the following command instead:
`
echo --extra-libs=-latomic >> ffmpeg_options
`Hi Ben,
Thank you for pointing this out. I have updated the tutorial to use the correct version of this line.
Cheers,
Emmet
Hi Emmet,
I don’t leave feedback often, but in this case, well thanks a lot for this crystal clear guide!! It works like a charm!
Regards
Mathias
This was really helpful! Thank you!!
First I want to say WOW & Thank You! This article is wonderful/worked perfectly for me the first try!
By chance is there a way to have that command run on startup? I have tried a couple of ways with no luck.
By “that command” I mean plexmediaplayer –fullscreen –tv
Hi William,
Sadly at this stage I haven’t had much luck with getting it to start at boot.
If I work out a solution in the mean time I will be sure to reply to this comment with it.
Cheers,
Emmet
If you create the file
/home/pi/.config/lxsession/LXDE-pi/autostart
you can have PMP start at log in, if the pi user is set for auto login. You have to start everything you want, no just PMP. Here’s mine:The ‘
@
‘ says to retry things if they fail.lxpanel
puts the menu panel on the bottom of the screen,pcmanfm
starts the file manager,xscreensaver
starts the screen saver, and theplexmediaplayer
line starts PMP.+1 to Gene Latham’s suggestion, but just a note — the double-dashes in that command line, before all of the options, have been replaced with m-dashes — so you’ll need to fix that if you want to use the same config.
How can I remove this if completed successfully ?
Hi Kerry,
As this wasn’t installed as a typical package it does require extra steps to remove.
I haven’t tried this myself so take the following steps with care. These steps are basically just uninstalling all the files that the final install command does.
Remove the desktop desktop config file
Remove its icon
Delete the qt web engine reosurces
Finally remove the plex media player client resource folders
Remove the plex media player binary
Remove the plex media helper
There is also the additional packages installed that we need to remove, including mpv and qt5 but the above steps will remove the plex media player itself.
Honestly, if you wanted to strip it back any further it would probably be easier to just start a fresh copy of Raspberry Pi OS.
Cheers,
Emmet
Aloha Emmet,
Before I start this project will it run ok on the Pi 4B 4 GB or is the 8GB recommended.
Hi Paul,
It should be fine to run this on a 4GB Raspberry Pi 4. You are more likely to run in to issues with the processor of the Raspberry Pi then you are with the RAM.
From my experience the Plex Media Player eats up more CPU time then it does RAM.
Cheers,
Emmet
Hi
thanks for a great guide, it works fine on my rpi 4 8gb.
Regards Michael
i am getting at the very end after running “plexmediaplayer –fullscreen –tv
”
error: “Could not initialize egl display
Aborted”
Hi Aniel Arias,
Make sure that you run that command on your Raspberry Pi itself and not over SSH.
From memory that error is caused when using it over SSH as techically there is no display attached to the SSH session.
Cheers,
Emmet
i just realized i used the lite version and not the desktop, my bad
would this work on Rpi 2B?
Hi,
You would be better off using RasPlex on that device. Using the official Plex Media Player will likely run you in to performance problems with the older Raspberry Pi’s.
Cheers,
Emmet
after i run ./rebuild -j$(nproc) and i try to install it says “The project was not configured: run “waf configure” first!” did i do somthing wrong or am i missing a step
Hi Anthony,
It looks like there is some compilation errors occuring. I’ve made some adjustments to the tutorial to hopefully solve these.
Please try running Step 2 under the “Preparing to Compile the Plex Media Player, on the Raspberry Pi” section again.
Then try recompiling MPV again.
Hopefully the issue should be solved now.
Cheers,
Emmet
I am getting the same exact error. After running ./rebuild -j$(nproc) in step 4 of the “Compiling MPV on the Raspberry Pi” the next step 5 “sudo ./install” command gives the error “The project was not configured: run “waf configure”. I bet this is were the poster above is getting this error as well. Can’t comment on the next section about “Compiling the Plex Media Player on a Raspberry Pi” as I’m stuck in the first section.
Hi Scott,
Ok I’ve done a bit more problem solving.
Try running the following two commands within the
mpv-build
directory.Followed by the rebuild and install commands.
I’ve updated the tutorial to use these additional steps as well.
Cheers,
Emmet
I am also having this issue, it used to work fine but now I just can’t install it on a new pi4…. Any ideas?
Waf configure
Hi, I had the same problem and then discovered that if you use the Raspbian OS Installer you get this problem, but if you follow the link at the top of this page to the Raspbian Buster download, download the image without recommended apps and write it to an SD card using Etcher, then the above problem doesn’t happen and it compiles ok.
Hey,
The whole thing worked beautifully until I got to the ./make -j$(nproc) command near the bottom. That hits me with “No such file or directory.” I have triple checked my work. just wondering what I screwed up?
Hi Scott,
Try running the command without
./
at the start of it.Cheers,
Emmet