Tuesday, January 24, 2017

Pi Drive!

I'm still playing around with the Raspberry Pi. I stick to the '3', there isn't a big cost savings using the earlier models and there's a big performance hit. Plus all my cases and other accessories are guaranteed to fit.

My Plex media server project is coming along. I just found out yesterday that my daughter has another 20 DVDs for me to rip, but once that is done I should be in good shape. As it stands I have about 780GB of data, requiring me to abandon my plan of using an SSD (too costly) and switching to a standard laptop drive.

Standard 2.5" hard drives have SATA interfaces, and the pi natively only works with USB drives. So you need a USB-to-SATA adapter, which are pretty common as they are used in drive upgrade kits. But Western Digital recognized an opportunity and created a 2.5" drive with a USB interface called the "PiDrive". I picked up a 1TB version for about $55 (way cheaper than an SSD).

Since the USB interface is 2.0, it takes about 15 hours to copy all the data to the drive. I'm waiting for my stackable case to come in so I can construct the finished product. I've hooked everything up for testing and I can stream HD videos to my Xbox One via the Plex client (which is free!).

What I am discovering are problems in the ripping of some movies. Mostly it's the case where multiple version of the content exist on the DVD, some with annoying commentary. In these cases I have dig up the disk, re-rip it, then update the image on the drive. I've only see 3 or 4 of these issues, but I'm concerned there could be more, I have no way of knowing without previewing a large sampling of movies.

Saturday, January 14, 2017

Media Serving

Wow! It's been a while. Not a lot has gone on though, so you haven't missed anything.

My asteroids arcade cabinet is still in pieces and needs a working monitor, that ain't happening any time soon.

What is happening is RetroPi. I discovered the Raspberry Pi when I was hunting for a low-cost solution to host my Plex Media server. I guess a little of the backstory is due.

I have a lot of DVDs. At first I thought it was perhaps 3-400, but now it's looking more like +500 as searching around the house keeps turning up more DVDs (and some Blu Rays!). Years ago (early 2000s) I had looked into ripping my DVDs along the lines of what I had previously done with my music library. At the time the technology and storage costs didn't make this simple (or cheap),  but a lot has changed since then.

Not only is storage cheap, not only are there scads of tools that make this process easy, but there are now free tools that make serving the media easy. The one I settled on is Plex because I use an Xbox One as my "media center" and there's a Plex app for my console that makes viewing the content simple.

So the Xbone has a client, but there's a server that needs to host the content and serve it to the client. For this I pressed a retired computer into service, it's about 3500 passmarks in terms of performance so it can easily server out the video streams. In addition it happens to have a 2TB drive, and since video files are big (typically 300-700mb per DVD, 3-6gb for Blu Rays), size matters.

So Plex is basically free, at least for how I'm using it (server -> xbone). I've been ripping my DVD library for weeks and have over 700 files (I have some series that contain multiple episodes per DVD), or about 690GB of data.

I'm using Media Center Master (MCM) to add metadata and organization to the video library. Plex will do a decent job of pulling metadata based on the video image file name, but collecting this information with MCM helps a lot and removes all ambiguities. For ripping the image from the DVD, I use HandBrake, which requires libcssdvd-2.dll in order to process encrypted DVD images (virtually all DVD images are encrypted). For DVDs with more robust encryption you'll need something like AnyDVD. There's a 21 day trial, which is probably enough to digitize your content, but if you think you'll need it on an ongoing basis be prepared to spring $50 or so for a license. You will need AnyDVD (or equivalent), about 5% of the DVDs in my library, and all the Blu Rays, required it.

Ripping is a royal pain in the ass! Handbrake does a good job of selecting the most likely master video file on the DVD, but it can be occasionally wrong. Ripping episodes from a series is probably the most difficult, in some cases the episode number is very hard to replicate.

It's important that when you put the files on the media server you segregate TV episodes and Movies. This will help Plex a lot, and tools like MCM benefit as well (when scanning episodes for metadata). Keep it simple:

Media
 \__ TV Shows
\__ Movies
 \__Home Movies


Raspberry Pi 3
How the raspberry pi figures into this is that hosting all these files on a PC, that will be up 24/7 adds up, figure 100 watts of electricity and a big, noisy machine. An embedded solution will be much less expensive to run (~10 watts), run silently and take of virtually no space (a deck of cards). The challenge is finding an embedded solution with enough cpu power to serve the video, particularly if transcoding is required.

Transcoding is the process of modifying the video stream to fit characteristics of the client. This can be the result of a need to change the resolution or the encoding standard that differs from how the video was ripped and stored. Transcoding is a very cpu-intensive process, and the typical embedded computer is not up to the task.

Fortunately the Raspberry Pi 3 represents a significant compute upgrade and can handle a transcoding a single video stream. At $35 it is also a very economical solution. In addition to the pi, you'll need a power supply (micro-usb, 2.0 amps at least) and a harddrive for the video files. The harddrive has to have a USB interface, the Raspberry Pi has 4, USB 2.0 ports, no way to connect SATA or IDE drives. Also, if the drive requires a lot of power (>1.2A), you may have to power it externally. In most situations, a 1TB, 2.5" drive with a USB-to-SATA conversion cable should do the trick.