Raspberry Pi Plex Media Player

In this tutorial, we will be showing you how to install the official Plex Media Player to the Raspberry Pi.

Raspberry Pi Plex Media Player

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.

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 4

Micro SD Card

Power Supply

Ethernet Cord or WiFi dongle (The Pi 3 and 4 has WiFi inbuilt)

HDMI Cable

Optional

Raspberry Pi Case

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 (Buster).

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. 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 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 python python-minimal git

There is quite a large number of packages to install, so this process may take some time.

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

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 and FFMPEG.

We can achieve this by running the following two commands.

./use-mpv-release
./use-ffmpeg-release

5. Start the compilation process by using the following command within the terminal.

./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 both FFMPEG and MPV 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 ./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.

1. Luckily for us, we will not need to compile this package ourselves as someone has already done that for us.

Let us download the latest release from koendv’s qt5 GitHub repository by running the command below.

wget https://files.pimylifeup.com/plexmediaplayer/qt5-opengl-dev_5.12.5_armhf.deb

We have self-hosted this file on our CDN just in case the original repository ever becomes unavailable.

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-get install -y ./qt5-opengl-dev_5.12.5_armhf.deb
rm qt5-opengl-dev_5.12.5_armhf.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=/usr/lib/qt5.12/ -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 Rasberry Pi, run the following command to open the Plex Media Player.

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.

Raspberry Pi Plex Media Player Library

You should now have the Plex Media Player up and running on your Raspberry Pi.

If you have run into any issues with getting this set up on your Pi, feel free to leave a comment below.

12 Comments

  1. Avatar for Michael Koch
    Michael Koch on

    Hi
    thanks for a great guide, it works fine on my rpi 4 8gb.
    Regards Michael

  2. Avatar for aniel arias
    aniel arias on

    i am getting at the very end after running “plexmediaplayer –fullscreen –tv

    error: “Could not initialize egl display
    Aborted”

    1. Avatar for Emmet
      Emmet on Editor

      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

    2. Avatar for aniel arias
      aniel arias on

      i just realized i used the lite version and not the desktop, my bad

  3. Avatar for Girishprasanna
    Girishprasanna on

    would this work on Rpi 2B?

    1. Avatar for Emmet
      Emmet on Editor

      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

  4. Avatar for Anthony
    Anthony on

    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

    1. Avatar for Emmet
      Emmet on Editor

      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

    2. Avatar for Scott
      Scott on

      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.

    3. Avatar for Emmet
      Emmet on Editor

      Hi Scott,

      Ok I’ve done a bit more problem solving.

      Try running the following two commands within the mpv-build directory.

      ./use-mpv-release
      ./use-ffmpeg-release

      Followed by the rebuild and install commands.

      I’ve updated the tutorial to use these additional steps as well.

      Cheers,
      Emmet

  5. Avatar for Scott
    Scott on

    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?

    1. Avatar for Emmet
      Emmet on Editor

      Hi Scott,

      Try running the command without ./ at the start of it.

      Cheers,
      Emmet

Leave a Reply

Your email address will not be published. Required fields are marked *