Raspberry Pi Plex Media Server

31 Dec 2016

There are many useful posts about how to set up a Plex Media Server on a Raspberry Pi but I wanted to share what I found most useful and any “gotchas” I found along the way.

Hardware

Setup

The first issue I faced was how to connect my Raspberry Pi to my hidden wifi network. To solve it, I found this site useful.

Setting up Plex on the Raspberry Pi was pretty straightforward following these steps.

Since I was copying my movies and other media files from my Mac to an external drive used by the Raspberry Pi, I had to format the external drive such that it could be read both by my Mac and by the Raspberry Pi. To do this I used the ExFat file format. Here are instructions on how to set up and format the drive. Where the instructions use the “mnt” command, I instead used “sudo mount”.

Operations

Here are a few useful commands I found for operating my Plex server:

To unmount the external drive:

cd /mnt
sudo umount driveName

To reboot the Raspberry Pi:

sudo reboot

To shutdown the Raspberry Pi:

sudo shutdown

To start the Plex server:

sudo /etc/init.d/plexmediaserver start

Getting Content

I had numerous DVDs and BluRays that I had purchased that I wanted to make available on my Plex server for convenience. To do this, I ripped them using Handbrake on my Mac.

Scrambled DVD Content

In some cases, after ripping a DVD the content produced was scrambled (it showed up jittery and pixilated). To fix this, I had to install hte libdvdcss library. The simplest way to do this is to use HomeBrew. If you don’t have HomeBrew already, it is super easy to install and I highly recommend it. Once installed, simply run this command:

brew install libdvdcss

Then, restart Handbrake (if it was already open) You can also install the libdvdcss library manually by following these instructions. For quick reference, here is the main page for the library and a direct link to the download page (choose the latest version)

Encoded BluRays

To rip BluRays you need the ability to decode them. Thankfully, there is some useful software called MakeMKV that will do this for you. Normally, you would need to rip the BluRay using MakeMKV then convert it to your desired format using Handbrake. Thankfully, you can also link the library directly into Handbrake and let it rip the movies directly. This article describes how to set it up. MakeMKV is in beta and free but requires an access key to work. You can get the latest access key here.

Naming Conventions

I frequently referenced these pages to ensure I was naming my video files correctly so that Plex would not have any issues gathering the correct metadata (movie posters, etc)

Troubleshooting

Direct Playback not working

Many of the videos (esp BluRays) were encoded with H.264 Level 4.1 instead of Level 4. Changing the setting on the Plex client to use 41 instead of 40 allowed for direct playback and prevented problems due to encoding.

Live TV not working

service plexmediaserver stop

sudo rm /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Http/tv.plex.providers.epg.xmltv

service plexmediaserver start

On plex client (FireTV app), delete cache, delete data and restart

Video Buffering

https://support.plex.tv/hc/en-us/articles/201575036

Handbrake Finishes Instantly

While ripping some DVDs Handbrake will finish almost instantly and create a small file (only about 3KB) that will not play properly. To fix this, in Handbrake go to the menu > Handbrake > Preferences > Advanced. Then under the section labeled “DVD Reader” uncheck the box that says “Use libdvdnav (instead of libdvdread)” You will then need to rescan your DVD before trying to rip it. Change the setting back when you are done.

Source

Updating your Server

Periodically, Plex will release software updates for their server software. I found that downloading the latest version from the settings page of the Plex UI did not work. Instead, you need to update using apt-get from the command line.

sudo apt-get update
sudo apt-get upgrade