Create a Plex Media Player with a Raspberry 4

I used to run Rasplex on a RPI 2 to play movies from my Plex Media Server. Unfortunately Rasplex has not been updated to run on a RPI 4. Here is how to build PMP for RPI 4.

Click to Read More

Install an OS on your RPI 4

  1. Download the "Raspberry Pi Imager" here.
  2. Download next the "Raspberry Pi OS (32-bit) with desktop" here (the 64-bit is still only in beta. See here). Unzip the file.
    • This is the smallest image (no extra softwares) with a Desktop (mandatory to display the Plex Media Player GUI)
  3. Install and Run the "Raspberry Pi Imager" to setup the "Raspberry Pi OS" on a micro-SD card.
    • Click on "Choose OS"

    • Select "Use Custom"

    • Pick the .img file "YYYY-MM-DD-raspios-buster-armhf.img" unzipped from the "Raspberry Pi OS (32-bit) with desktop" image.
    • Next Click "Choose SD" and "Write".
    • Once the operation completed, install the micro-SD in your RPI 4 and turn it on. The Raspberry Pi Desktop will appear after some automatic reboots. Follow the setup of the Welcome screen. Steps are:
      • Setup the Country (use Page up and Page down in the Country Combo to scroll faster)
      • Change the Password of the user 'pi'. ATTENTION: the keyboard layout is most probably not the right one. Untick the "Hide characters" option to check what you type!
      • Set Up Screen
      • Select Wireless Network (You can skip this step if the RPI is connected via ethernet). Again, untick the "Hide characters" option to check what you type!
      • Update Software
      • Click "Restart" on the last step "Setup Complete"

Configure your OS

Open a "Terminal" :

First, type this command in the Terminal to check your IP address:


Type next this command to configure the os:

sudo raspi-config

Among other:

  • Configure your keyboard if required via "4 Localisation Options" > "change keyboard layout"
    • If your keyboard is not in the list, use the Generic 100x-Key PC corresponding to your layout. Look the picture of this wiki page for more details.
    • You can possibly also find more info about your keyboard here.
  • Enable SSH via "5 Interfacing Options" > "P2 SSH"
  • Give at least 512MB or more to your GPU via "7 Advanced Options" > "Memory Split" (I did set 512. Using 1024 result in a black screen after reboot)
  • I gave the whole micro-SD card storage for the OS via "7 Advanced Options" > A1 Expand File System"
  • I set the audio output on the HDMI port via "7 Advanced Options" > A4 Audio"
  • NB.: I don't use the 4Kp60 HDMI, but it can be configured via "7 Advanced Options" > AA Pi 4 Video Output"
  • Finally, reboot to be sure that it still work.
    • If you have an issue, wait for 3 minutes and proceed with the next step here under.


You can now open a SSH console from your PC (E.g: using PuTTY) to connect on the IP address found previously and login with the user 'pi' and the password you introduced during the installation.

You will possibly get a PuTTY Security Alert because of the ssh key fingerprint... Accept if you are sure that you are connecting safely to your RPI.

If it seems that your RPI didn't reboot properly and you are not able to connect using SSH after a moment, they you probably have to redo to whole setup from scratch and try other configuration options within raspi-config

If it seems that your RPI didn't reboot properly and you are able to connect via SSH, redo the configuration with the command sudo raspi-config (try to reset the "Memory Split" to 64 if you did change it).

If you want to be sure that your OS is up-to-date, with the very latest fixes, type the following commands:

sudo apt-get update
sudo apt-get full-upgrade

And finally disable the screen sleep with the command

sudo sed -i 's/#xserver-command=X.*/xserver-command=X -s 0 dpms/g' /etc/lightdm/lightdm.conf

Build PMP for your RPI 4

Use now the SSH console (to be able to copy/paste from here) to execute this:

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

Then these 3 commands:

sudo apt-get install -y ./qt5-opengl-dev_5.12.5_armhf.deb
rm qt5-opengl-dev_5.12.5_armhf.deb

And finally these:

mkdir ~/pmp
cd ~/pmp
git clone git://
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

Now, PMP can be run. Go back to the Raspberry Pi Desktop, and type this command in a Terminal:

plexmediaplayer --fullscreen --tv &

In my case, the option 'tv' is not convenient (I can't see enough on the screen)...

You will have to Sign In via the link page of and next configure Plex Media Player.

Configure PMP to launch at boot

Back into you SSH Console, on your PC, create a new user 'plex' with a password:

sudo adduser plex
sudo adduser --disabled-password plex
sudo passwd -d plex

Login as 'plex' in your RPI desktop to run once PMP via a Terminal (Without this step, it will not be displayed full screen after an autologin):

plexmediaplayer --fullscreen --tv &

Configure the user 'plex' to autologin with a desktop session named 'plex':

sudo sed -i 's/#*user-session=.*/user-session=plex/g' /etc/lightdm/lightdm.conf
sudo sed -i 's/#*autologin-user=.*/autologin-user=plex/g' /etc/lightdm/lightdm.conf
sudo sed -i 's/#*autologin-user-timeout=.*/autologin-user-timeout=delay/g' /etc/lightdm/lightdm.conf

Create the 'plex' desktop:

sudo nano /usr/share/xsessions/plex.desktop

and paste into it:

[Desktop Entry]Name=Plex
Comment=Plex Media Player

And now reboot ! (It can take 3 long minutes !!):

sudo reboot

If there is a configuration issue with the desktop, edit the config via a SSH console and restart lightDM (the Desktop Manager):

sudo service lightdm restart

Tips: I had no issue with getting Plex Media Player in fullscreen but here are notes in case I would have to resize it:

sudo apt-get install -y xdotool
export DISPLAY=':0.0'
xdotool search --onlyvisible --maxdepth 1 ""
xdotool windowmove {window_id} {posx} {posy} windowsize {window_num} {sizex} {sizey}


This is based on a post of Stueh on Plex forum (see here)


If you did configure Plex Media Player on a PC Screen and move next on TV Screen, it will most probably not fit that screen et the resolution will possibly not be correct. In that case, here is how I proceed:

  • Log on your RPI using any SSH console on your mobile or Tablet (I presume that your PC is not next to your TV). I am using "RaspController" on Android
  • Edit the desktop to force an error. Hence, you will fallback on the default Desktop. Type in you SSL console : sudo nano /usr/shared/xsession/plex.desktop
    • Ex.: modify this line to define an invalid path: Exec=xxx/usr/local/bin/plexmediaplayer
  • Now, restart LightDM
    • Either type this in your SSH console: sudo service lightdm restart
    • Or CTRL-ALT-Backspace on the keyboard of your RPI.
  • You will get an error message because 'xxx/usr/local/bin/plexmediaplayer' does not exist and next get a prompt to login.
  • Login as 'pi' 
  • Now, open the Start menu > Preferences > Raspberry Pi Configuration > Display (or Interfaces). If you don't see the 'Start menu' because it is out of the screen, press the 'Windows' key on your Keyboard.

  • Next, change the resolution to fit the limitation of your TV:
    • 480p = DVD, old TV 720 x 480 pixels, format 16/9.
    • 720p = HD Ready, 1280 x 720 pixels, format 16/9.
    • 1080p = Full HD, 1920 x 1080 pixels, format 16/9.
    • 2160p, UHDTV1, 3840 x 2160 pixels, format 16/9 (a.ka. UHD-4K or 4K).
    • 4320p, UHDTV2, 7680 x 4320 pixels, format 16/9 (a.k.a UHD-8K or 8K).
  • Then, open Plex Media Player (Start Menu > ...) and configure it in TV mode. If it does not fit the TV Screen, reduce the resolution.
  • Finally, log off (or restrat lightDM with CTRL-ALT-BACKSPACE) and login as 'plex' to also run Plex Media Player and be sure it's also well configured.
  • Ho, yes, sure: edit again the plex.desktop to remove the xxx in the path of the EXEC setting and reboot.


Leave a Reply

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