Plex has become one of the most popular do-it-yourself media servers for home use. The low-cost Raspberry Pi is capable of handling personal Plex streaming demands and integrates neatly into home theater setups.
In this expanded guide, I will cover how to optimize your Plex Media Server on the Raspberry Pi for the best performance. Ways to expand your storage, enable secure remote access, and other recommendations will also be provided from my years of experience as a Linux administrator and open source programmer.
An Appropriate Platform Choice
There are over 100 million active Plex users as of 2022, with many self-hosting their server on Raspberry Pis. But is that the best choice given the Pi‘s modest ARM processing power?
Direct Play Capabilities
While intensive transcoding is impractical on a Pi, their support for hardware video decoding makes direct play streaming very feasible:
- H.264 (MPEG-4 AVC) – 1080p streams at 30fps
- HEVC (H.265) – 1080p streams with Plex Pass subscription
- VC-1, VP8/VP9 – 720p streams via software decoding
Based on the media formats uploaded by most amateur Plex users, the Pi 4 has enough decoding power to easily handle a few simultaneous direct play streams which is great for personal use.
Comparable Alternatives
How does the Pi 4 stack up to alternatives like old desktop PCs when repurposed as budget Plex servers? Using Jeff Geerling‘s media server benchmarks for reference:
| Device | Avg CPU Utilization | Avg RAM Utilization | 1080p to 720p Transcoding | Price |
|---|---|---|---|---|
| Raspberry Pi 4 4GB | 40% | 34% | Struggled | $70 |
| 2009 iMac (Core 2 Duo) | 25% | 18% | 56 fps | $50+ |
| Dell Optiplex 7020 (i5) | 15% | 20% | 148 fps | $150+ |
While the desktops performed better for transcoding, the Pi 4 delivered smooth direct play streaming with reasonably low resource usage – proving itself as a capable Plex platform. Prices also favor the Pi.
So the Pi strikes a strong balance in being powerful enough for personal streaming while maintaining affordability and low electricity costs – especially when placed in idle scenarios.
Step 1 – Installing Raspberry Pi OS
The first step is getting Raspberry Pi OS installed…
Flash SD card with Raspberry Pi Imager
Initial boot options & expanding filesystem
Changing default password
sudo apt update
sudo apt full-upgrade
Reboot Pi
Step 2 – Optimizing Performance
To get the best Plex performance on your Pi 4, there are some Linux performance optimizations worth applying involving overclocking and assigning CPU resources.
Overclocking
By default, the ARM CPU on the Pi 4 runs at 1.5 Ghz. This can safely be overclocked to 2.0 Ghz for improved processing power:
# Enable overclocking in raspi-config Advanced Options
sudo raspi-config
# Set CPU speed to 2000 MHz
echo "over_voltage=6" | sudo tee -a /boot/config.txt
echo "arm_freq=2000" | sudo tee -a /boot/config.txt
These settings increase the voltage slightly to accomodate the higher clock speed. Reboot to apply the changes.
Reserving CPU Cores
To prevent system functions from interfering with Plex transcoding, it‘s advised to reserve CPU cores specifically for Plex only. This is done via the cpuset parameter in the Plex systemd service file according to Plex:
sudo nano /lib/systemd/system/plexmediaserver.service
Add the highlighted parameters:
[Service]
CPUAllocaion=2
CPUSet=2-3
Nice=-10
LimitCORE=3
This reserves core 2 & 3 strictly for Plex, limits total CPU usage to 75%, and gives Plex streams priority bandwidth. Remember to reboot after making changes.
Now Plex will have dedicated CPU resources to handle streams smoothly without system functions interfering.
Step 3 – Installing Plex Media Server
With optimized performance settings applied, Plex can now be installed via the official package repository…
Import Plex GPG key
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
Add repository
echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
Install package
sudo apt update
sudo apt install plexmediaserver -y
The Plex server will initialize itself on first run. Navigate to port 32400 on your Pi IP to access it.
Sign into Plex web app or create account
Claim server & name it
Step 4 – Adding Media Libraries
With Plex set up, source media from the Pi filesystem can now be imported into Plex libraries.
Common locations for media storage
/home/pi/Movies
/home/pi/TV Shows
/home/pi/Music
Adding folders via the Plex web UI
Plex scanner analyzing media
NOTE: Large libraries take more time as metadata and assets are downloaded for every series & episode added according to Plex.
Step 5 – Remote Access
Accessing Plex while away from home requires enabling remote connections to your server. This involves proper port forwarding…
Understanding Port Forwarding
The Plex server communicates externally through TCP port 32400. For this traffic to reach your Pi behind a home router firewall, ports must be properly forwarded.
[Diagram showing port forwarding path – Created by author using Draw.io]
- Router receives inbound request to Port 32400 from Internet
- Router forwards this request to local IP (your Pi Plex server)
- Pi server responds back through router over established connection
Consult your router admin interface to forward ports accordingly. Some consumer routers have automatic Plex port forwarding functions if UPnP is enabled.
With correct port maps active, remote access should connect succesfully granting your WAN facing IP address access to Plex.
Troubleshooting Remote Access Issues
If Plex remote access continues failing despite port forwarding attempts, try these fixes:
Enable UPnP – Routes traffic automatically without manual port entry in router.
Change Plex Listening Port – In case another program occupies port 32400 already:
sudo nano /lib/systemd/system/plexmediaserver.service
# Edit these ports
PublishNotices=tcp://10.1.1.23:33400 system-public-ip-here:32410
Use a Dynamic DNS – To assign static hostname if your ISP IP address changes periodically:
- Popular free options:
- DuckDNS
- No-IP
- FreeDNS
Updating these records with your frequently changing public IP ensures name resolution to your Plex server works reliably.
Step 6 – Expanding with Shared Storage
While usable space on the base Pi is limited, remote network shares from a NAS make excellent extended Plex media storage.
Some ways to mount additional repositories:
Network Shared Volumes
Network attach storage (NAS) appliances like those offered by Synology, QNAP, and Terramaster provide centralized accessible storage to machines on your local network.
They connect over protocols like SMB, NFS, AFP or iSCSI. Using NFS as an example for the Linux-based Pi:
Install NFS Client
sudo apt install nfs-common
Mount Remote NFS Share
Add mount point to /etc/fstab:
192.168.1.150:/PlexMedia /mnt/PlexMedia nfs defaults 0 0
Refresh Mounts & Test
sudo mount -a
df -h
This will seamlessly fuse storage space from a NAS onto your Pi server.
Alternative SAN Solutions
An alternative solution called "Pi-RAID" developed by Sasha Eriksson allows hooking up an array of USB hard disks to a Pi 4 functioning as a storage area network (SAN).
By combining multiple drives, more data redundancy and throughput is achieved. An inexpensive option over buying a dedicated NAS.
Importing Libraries from Mounts
With new network volumes or external drives now attached to your Pi, their media contents can be imported into Plex via the web UI like before. The Plex scanner will intelligently identify media files wherever they exist on connected repositories.
This allows expanding limited onboard storage space substantially!
Competition Compared
While Plex is arguably the most popular DIY media server, competitors like Emby and Jellyfin offer comparable open source alternatives worth mentioning.
Emby
Emby provides similar media management and streaming capabilities to Plex. However based on multiple benchmark tests, like those conducted by Erik‘s Tech Talk, Plex has achieved better video encoding speeds:
| Server | 1080p HEVC to H.264 FPS | 720p HEVC to H.264 FPS |
|---|---|---|
| Plex | 50 | 160 |
| Emby | 22 | 140 |
Plex even slightly edges out Emby in user interface performance when accessing via web browser:
| Server | HTML5 Direct Play Page Load | Transcode Page Load |
|---|---|---|
| Plex | 500 ms | 1600 ms |
| Emby | 700 ms | 2900 ms |
So while Emby works perfectly fine, the Plex ecosystem does demonstrate performance advantages in testing when running on limited hardware like the Pi 4.
Jellyfin
Another alternative is the free software Jellyfin project started by ex-Emby developers. In Cloudbox‘s testing, Jellyfin used roughly 40% less RAM versus Plex when streaming content on the Pi 4.
However Jellyfin delivered high CPU usage spikes compared to the stable Plex which could risk impacting performance. Transcoding also took a substantial 15-20 seconds longer to initiate through Jellyfin during testing.
So while Jellyfin makes better use of RAM, the Plex ecosystem seems more tailored for stability based on observed Pi 4 streaming benchmarks.
Conclusion
Optimizing Linux performance settings and overclocking allows the Raspberry Pi 4 to reliably handle multiple direct play Plex streams – proving itself as a cost-effective alternative for do-it-yourself home media servers.
Methods to expand your storage were also covered between NAS appliances and Eriksson‘s SAN solution for the Pi. Troubleshooting guidance was provided to get remote access functioning securely through protected ports.
So whether you‘re a media enthusiast or just looking to cut the cord from expensive streaming subscriptions, the Pi 4 makes for an impressive little Plex box.
Let me know if you have any other questions!


