NVidia Shield: Another Option for Plex

For father’s day this year, I was given an NVidia Shield.  While I’ve only had it for a few days so far, it is already my favorite media platform.

Under the covers it’s just Android TV, which I’ve had before using the Nexus Player, but unlike the Nexus the Shield has the Amazon video app.  In fact, it supports all of the major media services that we try to use.  And on top of that, there are games!

The Plex client works great.  It can additionally act as a Plex server, either with local storage or by attaching additional USB storage.  Additionally, the Plex client for the Shield has built in support for the relatively new Plex DVR functionality which allows you to record live television by using a network enabled TV tuner.

At $199 with 4k video output support, it’s a fairly good price.  You can also potentially get the older model for cheaper as well.

Plex space usage

One item to consider when setting up a Plex server for the first time is space allocation.  Plex servers can use up a lot of disk space and not necessarily where you expect, so it’s better to be educated than blind sided.

The vast majority of space you can expect to use on your server is going to be for movie storage.  The location where you store your movies is completely up to you and is configurable when you first set up your libraries.  In my case, I created a path called /home/media on the server which contains directories for movies, tv shows, music, etc.  Each of those directories results in its own Library.

The less expected space is under your /var partition, which can be a problem if you allocated a small amount of space for / or /var and put the majority of your disk space under /home.  (As an aside, consider using LVM or ZFS for your disks in order to be able to reallocate space on the fly.  I’ll have to write up more about this in the future).

The space in /var will be found in /var/lib/plexmediaserver/Library/Plex Media Server on Ubuntu.  I suspect other Linux distributions will be the same, although there could be some variance if you’re using something like FreeNAS or installing Plex via a container.

This space contains a lot of really useful things, for example your installed plugins, logs, the metadata for your server, and transcoded media files.  The last one is where the bulk of your space will go to.  On my server this space in /var takes about 20GB (compared to 2TB in /home/media).  Plex does however support preemptively optimizing video files for playback.  This feature is useful on slower hardware that may not be able to transcode on the fly, but the resulting media files will also be stored in /var.

Protecting Your Content

Assuming you’re ripping and decoding your own media, you’ll find that the process is slow.  How slow depends on your specific hardware.  You can expect a DVD rip and encode to take at least 10 minutes or so though.  Even longer for a Bluray rip.

This isn’t too much of a hassle when buying and then ripping discs which you have purchased, but it can be extremely painful when you’re first ripping all of your existing discs.  Due to this, you’ll want to take the right steps in order to ensure that you do not need to rip the discs more than once.

Backup

The most important thing to do in order to protect your content is to come up with a backup solution of some sort.  There’s no hard and fast rule for how you should back up your content.  Instead you’ll need find the balance between cost, hassle and effectiveness that makes sense for your needs.

The simplest backup solution would be to have an additional external hard drive of an appropriate size for you to copy your data to on some regular basis.  This approach tends to be fairly fast and not very expensive and will help protect against loss caused by mistakes made on the server or a failure of your disk.  This approach however will not help if something was to happen to your home.  A fire could easily take out both your primary server and your backup disk.  Perhaps this is an acceptable risk for you, or at least the least of your worries in the event of a house fire.

Another inexpensive method requires that you have a friend with a server set up as well.  You can choose to mirror each other’s content over the internet in order to provide both of you with a backup plan.

Another option is using an online backup solution.  Personally I use Crashplan.  Crashplan has a free option which provides for encrypted backup to other people’s computers for no cost.  Alternatively they offer backup to their own servers for a pretty reasonable monthly cost.

Finally, you can roll your own solution using one of the various cloud providers out there.  Box.net, Dropbox, Google Drive, Rsync.net and others all offer large amounts of file storage for purchase.  The costs, compatibility and performance will vary from service to service.

Storage Redundancy

While offline backup is critical for ensuring your data, recovering can be time consuming and painful, so any steps you can take in order to avoid needing to do it is useful.  The simplest step is to protect yourself against disk failure by using some form of redundancy.

The most common form of this sort of redundancy is a Redundant Array of Inexpensive Disks, or RAID.  RAID comes in different levels which provide for different amounts of protection.  They range from RAID1 which completely mirrors your content between two disks, and RAID5/RAID6 which allow you to combine a number of disks together to increase your storage capacity while putting aside one or two disks for parity.  These parity disks allow you to survive losing a disk or two in your array without losing your data.

The other solution is ZFS, which is a newer system developed by Sun Microsystems (now part of Oracle), and open sourced as part of OpenSolaris.  It was then made available for FreeBSD and now a port is available for Linux as well (although it does have some licensing issues).

ZFS works a lot like RAID, but provides a lot of advanced features too including snapshotting, transparent compression, and remote replication.  It’s a good choice for NAS devices or Linux systems if you’re an advanced Linux admin.

Plex Media Formats

What are media formats?

By media format, I mean a few different things which tie together in order to contain your movie and the rest of its support media.

Container Format

The container is essentially the file format.  Containers can hold multiple video, audio, picture or subtitle tracks in a single file.  For example your container may contain multiple video tracks for a movie (one per chapter), English audio, Spanish audio, Dolby 5.1 audio in various languages as well as subtitles or closed captioning.

The most common container formats I’ve used with Plex are MPEG-4 Part 14 (better known as MP4) and Matroska Multimedia Container, also known as MKV.  You may also see AVI, MPEG-2, Ogg or Flash.  You can find quite a few container formats on Wikipedia.

Video Codec

Within the container file you’ll file one or more video streams encoded in one or more video codecs.  Your container can contain a number of different video streams in different codecs, and video streams of a given codec may be contained in different container formats as needed.

Some common video codecs are the H.26X codecs from the Motion Pictures Experts Group (MPEG).  These include H.262, H.263, H.264 and H.265 among others.  The MPEG group puts out very good video codec standards, but tends to require licensing fees for devices which use them.

Google has published their own set of video codecs including VP6, VP7,VP8 and VP9.  Or really, the codecs were created and published as proprietary codecs by a company called On2 which has since been purchased and opened by Google.

Theora is another open video codec which was initially based upon the VP3 codec from On2.  It was created by the Xiph.org Foundation, the creators of the Ogg container format.

Audio Codec

Your container files will also contain one or more audio tracks.  These could be multiple sequential audio files, or they could be the audio for the same section of video available in multiple languages.

These could be lossless codecs like ALAC and FLAC, or a lossy codec like MP3AAC, or Vorbis.

What is right for you?

At the end of the day what is right for you depends on a number of things including available disk space, available bandwidth, hardware playback support and server processing power.

Disk Space

Lossless compression formats will provide you with the best quality, but at the expense of size.  If you’re willing to discard some of the information in the video stream in order to decrease the amount of actual data stored, then you will be able to fit more movies in the same amount of space.

Available Bandwidth

Larger files also take more bandwidth to transfer.  If you’re attempting to serve the files over a low bandwidth connection, then heavier compression may work better for you.  Note that this typically will mean your local LAN bandwidth rather than your internet connection, unless you’re serving video to people outside of your home.

Hardware Playback Support

Video decompression can take a lot of CPU cycles to perform.  This is not a big problem for modern desktop hardware, but it could be an issue for embedded devices like phones, tablets or set top boxes like the Roku/TiVo/etc.

One of the way hardware manufacturers help make their devices more usable for video streaming is to include specialized decoding hardware in order to offload the decompression from the CPU itself.  This hardware will only have support for specific container or codecs, so you may find it useful to create your video files in a manner that your hardware specifically supports.

Server Processing Power

In order to improve support for various clients, Plex servers also support transcoding.  Transcoding is the process of decoding the video streams on the fly, and then re-encoding them in a format that the client can more easily play.  This provides you with better client compatibility but at the expense of CPU processing time on the server side.

Depending on your server hardware, you may find that transcoding is sufficient to support your needs.  If your hardware is low end however, like some of the available Network Attached Storage (NAS) hardware with built in plex servers, then you may not be able to keep up with the clients.  Also, if you share your plex server with friends, then multiple video streams transcoding at once may be too much for even beefier hardware.

What I usually do

My hardware is a bit beefier and modern, so I tend to stick with the default recommended settings for Handbrake.  I direct stream to my clients when possible, and allow the server to transcode as needed.  So far it has worked for me.