I had lunch recently with a friend who, like me, doesn’t pay for TV service. All of our viewing options are over the air or off the Internet. During that discussion, he told me about the Plex Media Server that he uses to manage many of the Internet video options in his house, as well as many of the DVD movies that he owns. It sounded like a pretty slick system, so that night, I installed it myself on my Ubuntu Linux 14.04 home computer.
My photo collection, at which I pointed PMS, contains well over 100,000 images. The first time I ran a backup after Plex indexed the photo repository, the backup took forever. It turns out that PMS indexes all of the metadata for every file that it knows about, and places this index in the directory:
“/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Media“
On my server, that Media folder contained 18GB of very tiny files. It wasn’t a problem for the server (it sat on a nearly empty SSD), but it made the backups take forever. Because PMS can regenerate all of that info from the existing media files, there’s no reason to back it up anyway. The two ways around this are to (A) exclude the Media directory from the backup script, or (B) move the Media folder to a different drive that’s already not backed up, then create a symlink to it from its original location. Since all of my ripped DVD’s are already on an un-backed-up drive, I chose (B). [Edit: I later decided to back that drive up anyway, but manually excluded the PMS Media.]
After a while of use, I found that the interactive console on my server machine would occasionally lock up on me for minutes at a time. “top” told me that during these lock-ups, the Plex Media Scan was running with a nice priority of -5. If I reniced the process to 0, everything would work well again until the next time a scan was initiated. You can set the CPU priority for Plex to 0 from the outset by editing the file “/etc/init/plexmediaserver.conf” and changing the “nice” line from -5 to 0. This may not be a good idea for a dedicated Plex server, but if you’re running the Plex server on a multi-purpose desktop box, I highly recommend it.
# apt-get install handbrake build-essential pkg-config libc6-dev libssl-dev libexpat1-dev libavcodec-dev libgl1-mesa-dev libqt4-dev
# tar zxvf makemkv-oss-1.8.10.tar.gz
# cd makemkv-oss
# ./configure && make && make install
# tar zxvf makemkv-bin-1.8.10.tar.gz
# cd makemkv-bin
# make && make install
If you want to maintain maximum image quality and don’t care about disk usage, you can use the ripped MKV files directly. Plex will transcode them on the fly, if your server has enough horsepower. However, if you care about disk usage, or if you want to copy the files to a mobile device for off-line viewing, you’ll be better off transcoding the MKV’s into MP4’s right now. Transcoding the files with Handbrake takes about 1.5 to 2 hours on my computer. Handbrake on Win7 is also somewhat different than on Ubuntu 14.04. On the Win7 box, I set up a custom user preset with my common settings. Here’s what I changed from the defaults:
- Container: Mp4. The MP4 container plays nice with our Android mobile devices if we decide to copy the file there directly for off-line viewing. I haven’t encountered a situation where MP4 causes problems.
- Filters tab: Decomb: Default. The decomb filter removes the ugly interlacing artefacts that are present on cheaper discs. There are several settings for the decomb filter, but “default” gives the best results. The system default setting is actually “off.”
- Video tab: Video Codec: H.264. The alternative is MP4, but H.264 gives much better image quality, especially in areas filled by a nearly solid color. H.264 may actually be the system default, but I messed with it a lot, so I don’t remember any more.
- Video tab: Constant Quality: 19. Typical settings for H.264 quality are 18-20, with higher numbers yielding smaller files with lower picture quality. The difference in file size is significant, but the difference in picture quality is hard to see. 19 seemed like a happy medium.
While they’re not set in the user preset, here are some other changes I make with each video:
- Make sure the destination filename matches the name of the movie as closely as possible. This helps Plex correctly guess the movie title, and it helps you find the movie when you’re looking for an mp4 to download.
- Check the Audio table to ensure that your desired audio track is being used.
- Check the Subtitles track and click the Add button to add the subtitle track. This adds very little to the file size, and my kids really enjoy having subtitles available when watching quiet dialogue in a movie with loud noises.