Hi All,
Please bear with me if formatting is shocking, first post on these forums, so I’ll likely need to come back and re-format this post a couple times.
I recently (finally) managed to perform a Plex Media Player build and have it working reliably on my Raspberry Pi 4 Model B 2GB, so though I’d share the steps I found work reliably (so far).
Disclaimer: I am far from a programmer, so these are just the instructions which worked for me. I’m just a little old senior engineer in servers & storage, not Linux/programming. I performed the following on a Raspberry Pi 4 Model B 2GB - I suspect that it won’t run very well on a 1GB model, but would run nicely on a 4GB model.
So, I assume you’ve done the following:
- Installed the “Raspbian Buster with Desktop” OS on your SD card (not full featured desktop).
- Run through the initial config, set your hostname etc.
- Updated the operating system with then “sudo apt-get update” and then “sudo apt-get full-upgrade” commands.
- Set your GPU memory size to something reasonable (I used 512MB as this seemed happy).
- Turned off the screen sleep after x minutes by adding “xserver-command=X -s 0 dpms” to the [Seat:*] section of the file “sudo nano /etc/lightdm/lightdm.conf” (when PMP is playing, the screen still goes to sleep).
- Checked that video and audio is working as expected on your TV/monitor/whatever.
Now to the nitty gritty. Firstly, install the required dependencies for the upcoming build/installs:
sudo apt-get install -y autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake python3 python python-minimal git mpv libmpv-dev
So you’re aware what the packages are:
autoconf automake libtool libharfbuzz-dev libfreetype6-dev libfontconfig1-dev libx11-dev libxrandr-dev libvdpau-dev libva-dev mesa-common-dev libegl1-mesa-dev yasm libasound2-dev libpulse-dev libuchardet-dev zlib1g-dev libfribidi-dev git libgnutls28-dev libgl1-mesa-dev libsdl2-dev cmake`
These are the dependencies listed in the README at GitHub - plexinc/plex-media-player: Next generation Plex Desktop/Embedded Client
python3 python python-minimal
These are extra dependences missed in the README for PMP
git mpv libmpv-dev
Git is needed to download from git, while mpv is needed because I can’t be bothered building MPV from source.
Now instead of build QT5 from source, again being lazy, we can install QT5 from a package the lovely kiendv has already made for us (see: GitHub - koendv/qt5-opengl-raspberrypi: Qt5 with desktop OpenGL on a Raspberry Pi 4):
wget https://github.com/koendv/qt5-opengl-raspberrypi/releases/download/v5.12.5-1/qt5-opengl-dev_5.12.5_armhf.deb
sudo apt-get install -y ./qt5-opengl-dev_5.12.5_armhf.deb
rm qt5-opengl-dev_5.12.5_armhf.deb
Finally, we can build PMP:
mkdir ~/pmp
cd ~/pmp
git clone git://github.com/plexinc/plex-media-player
cd plex-media-player/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DQTROOT=/usr/lib/qt5.12/ -DCMAKE_INSTALL_PREFIX=/usr/local/ ..
make -j4
sudo make install
Note the double dots at the end of the cmake line.
After this, Plex Media Player will appear in the Application menu in the GUI, or you can run it from terminal just by running
plexmediaplayer
I needed to run it once from terminal to set it to TV mode and fullscreen, but after this it remember those settings for me:
plexmediaplater --fullscreen --tv
As an example of how things are performing, I’m currently playing a HD channel from Live TV (I have the DVR feature) and htop is showing:
CPU: All cores average around 45%
Memory: 635M used of 1.89G
Swap: Unused
It looked exactly the same when playing 1080p videos at 60fps. I don’t have 4k or any 4k videos to test with, sorry!
Bon appetit.