Building a Home Media Server

In this day and age the use of physical media in your home theatre is very passé. It is so much more convenient to have all of your movies, home videos, television shows and more available on your network and available at the touch of a button – “on demand” to borrow the term from the DVR crowd.  You can modify your existing multimedia collection to put it onto your home network and you can do so at minimal cost.  For many people all of the pieces already exist and all that is left to do is to put it all together.

In this article I am going to run through the components necessary to put together a very nice workflow for creating a working home media network.  When you are done what you will have is the ability to sit in your living room, or any other room of your house, and browse through your movie, photo and music collections with nothing more than your remote control and watch them instantly without ever having to get up and search for a disc, trying to remember what movies you own, trying to figure out who say what song or what album it is from or more and your videos or music will start instantly.

So what do we need to get started on this?

There are three essential steps.  In the first step we take any existing media like DVDs and we have to “rip” them so that we have a local copy on our computer.  The second step is transcoding – we will be taking the raw DVD file and turning it into a high efficiency h.264 media file which will look nearly as good as our original DVD but at a fraction of the original size so that we can store many more movies.  The final step is to load these movies into a UPnP/DLNA server and make them available on the network.

To do all this we will need a few, free pieces of software and one really important piece of hardware – our media viewer.  The media viewer hardware is the piece of the equation that attaches to our television to make all of this magic available there.  For me, the best hardware for this many people already have – a Sony PlayStation 3.  The PS3 works amazing well for this and really cannot be beat.  If you already have a PS3 or are thinking about getting one anyway then you are in great shape. If you have an XBOX 360 then we should be able to make that work for us as well.  You can also use a computer hooked to your television, an Apple TV or any of many, many different devices.  My experience is with the PS3 and for that I will write this guide but do not feel that you should be limited to just this one device.  Also, you can add PS3 units (or a mix of different devices) all over your house so that every television in your house can access this media in the same way.  In addition to all of your televisions being able to access this centralized media you will also be able to get to the media from the computers in your home.

Step One and Step Two in our workflow are about converting our existing, legacy media (we will address DVD and CD media here) into modern, efficient, network friendly h.264 and MP3 files.  If you are working with home movies that are already converted to h.264 or music from a service like Amazon MP3 downloads then neither of these steps are necessary at all!  This is simply a conversion process to take our very old media and to prepare it for our new, modern system.  For DVDs, the second step is generally not even necessary but results in far better use of our storage and is almost always well worth the effort.

One of the great things about this process is that even though there is some quality lost in the transcoding process (this is a necessary side effect of all lossy transcoding, but our process does as much as possible to minimize this effect) there is a lot of work done by the process to “fix” things that were handled badly by the DVD encoding process originally (like interlacing and framerate changes) which now we can undo making the trancoded version sometimes appear actually better than the DVD original!

Step One: Preparing the Media (DVD)

In this step we will prep our video media for conversion.  This means removing the video from the DVDs, assuming that that is from where you are starting, and placing it, raw, onto your computer’s hard drive.  If you want to convert CDs for use with your media system you do not need to perform this step at all.  CDs can be converted directly from the physical disc directly to MP3 making them extremely easy to do.

The software that we will need to use to prepare our DVDs for conversion is called DVDFab and is a free download for the basic version of the software – and the basic version is what we want as the “advanced” features are all about lowering the quality of the DVDs for no reason and doing weird things that we definitely would never want to do.  So download the latest version of their software, find a DVD that you want to try first and let’s give it a go!

We will start with converting a simple movie.  Nothing fancy like a television show.  Start by picking out a movie without subtitles that is just a single movie on a single DVD.  This is most movies but if I don’t say it then we will run into some edge case which will take more work and we don’t want that to happen our first time out.

This part of the process can be a bit finicky so we need to adjust our process depending on what we are doing and how well it works.  We have two basic methods of ripping our DVDs.  The first is to rip the entire disc.  This takes up more temporary working space for us and requires more work when transcoding so we only want to do this when necessary – it is the correct method to use when converting television shows with several episodes on a single disc, however, as we will see later.  For movies we almost always want to allows DVDFab to detect the film on the DVD for us.  Then we can select, in its interface, the audio and option subtitle channels that we would also like to include.  DVDFab’s interface for determining which audio and subtitle channels we are interesting in keeping is far superior to anything that we will have later in the process so it is best to do this now if possible.

One of the big advantages of this ripping and transcoding process is that it gives us an opportunity to remove all of the extra “fluff” from the DVDs such as extra audio channels (do you really want to store the Spanish dub of that movie that was originally in English?), subtitle channels, ads, warnings, menus, etc.  Let’s face it, the menus of DVDs are a major detraction from the movies.  No one wants to wait for the menu to load up, make noise and make it confusing how to start the movie.  We just want our movies to play right away when we are ready to watch them.  This process removes all of this detriment from the DVDs and takes us back to the pure, simple world of “just our movie”.  Movie night will suddenly be a lot less frustrating.

If you want to include extra audio channels at this time, you can. For example, if you want that audio commentary track feel free to include it in the ripping process.  Personally I remove everything extra because I know that I am never, ever going to watch that movie or show with that extra audio track.  Ever.  But to each their own.  For me it simply is not worth the time, effort and storage space to keep all of that stuff.  With cartoons I will often include French and Spanish language tracks so that my daughter can watch the same movie in different languages but only for cartoons where there is no weird lip syncing and watching it in a foreign language is probably as good as seeing it in English anyway.

Once you have selected the audio that you want to keep you can click “Start” and DVDFab will do the rest.  This process generally takes around twenty minutes or so, depending on your DVD drive speed and other factors on your computer.  If you are going to be doing this a lot you may want to invest in a nice DVD player like a high speed, external HP unit that connects via USB2, but that is completely not necessary.

Once the DVDFab process is complete you should have a directory called “MainMovie” and in that directory will be the name of the DVD that you just ripped (in about one out of ten cases DVDFab is unable to determine the actual name of the movie for this folder and so calls it DVD or something like that.)  In that folder you will have a folder called Audio_TS and one called Video_TS – you don’t actually care about these but they are there in case you are interested.

That is it.  Step one in complete.  You no longer need the physical DVD at this point.  My advice is, after the entire process is done, that you pack up the DVD and put it someplace very safe since you need to retain the original DVD for legal reasons – if you sell or give away your original DVD the h.264 copy that we are creating changes from being an archival/backup copy of your original to being stolen so keep that in mind.  This is a process of improving the usefulness of your existing DVD library not a means to saving money by selling DVDs that you no longer need.

Step Two (DVD)

Now that we have our rip from DVDFab we are ready to try our hand at transcoding.  This is the complicated step with a lot of options.  The bottom line with this process is that you are going to have to make some decisions yourself and you are just going to have to try some conversions, see how they look for you and tweak settings from there.  No real way to get around that, I am afraid.  I will do my best to give you some starting points, though.

The software that we will use for transcoding is called Handbrake and, like everything else that we are using, it is free.  Download and install it and fire it up.  We will now convert our first rip from MPEG2 VOB into h.264.  (h.264 is a compression algorithm used behind the scenes in technologies like MPEG4, BluRay, QuickTime HD and WMVHD.  It gives us better compression ratios than does old MPEG2 allowing us to store more movies in less space at the same quality.  As with any conversion there is a loss of quality from the original but depending on what we want we can tweak that in Handbrake to minimize the quality loss while maximizing the size gains.)

Once Handbrake is open we need to open the “folder” in which we just ripped our DVD.  We do this by clicking “Source” in the top left of the Handbrake window and selecting “DVD/Video_TS Folder”.  This will open a browse dialogue and we just need to navigate into that “MainMovie” folder and select the folder named for the movie that we just ripped located there.  Handbrake will then look at this file – this can take up to a minute – to determine what options we have.

If the Handbrake detection goes well then we will see the Title and Chapters fields filled out automatically.  Normally the Title field will be correct and we will not need to modify it.  The Chapters fields can always be ignored.  For a normal movie Title should populate with the longest option from the dropdown.  So you normally do not need to even check this.  If you did the “select your movie and audio” option in DVDFab then Title will only have one option making this even easier.

Fill in the file field.  This is very important as you can accidentally leave this blank or leave in the name of a previously converted DVD and overwrite the file so always be sure to modify this each and every time you use Handbrake or you will be very sorry and have to do some work over again.  When you modify this you want to select “MP4” as your output type – at least for this, your first movie conversion.   Be aware that no matter what you pick in the naming dialogue Handbrake will change your entry and make it “M4V”.  This is a bug.  After you select the location and name to save the file you must go to the “Format” drop down menu and choose “MP4” again.  Don’t worry if you miss this and end up with an .m4v file.  Unlike most things this can be changed with a simple file rename after the entire process is complete.  The .mp4 or .m4v option is just a flag to the program playing the video so that it knows how to interpret the data.  The .mp4 extension works more reliably but generally gives you fewer features.  So for now we want to use it but after testing you may want to use .m4v or, like me, a mix of the two later on.

Now for the fun bit.  We need to select the correct compression settings for our particular video.  In this section it is a lot less about getting things right or wrong but more about getting the settings to be where you want them.  Likely you will play with these for a while, watch some videos and decide to move in one direction or another.  I am just going to attempt to give you some decent starting points so that you get good results from which to begin your tweaking.  I tend to lean towards pretty good video and audio quality without going over the top.  Almost all of my movie viewing, especially that coming from DVD (rather than from BluRay) is very casual and normally done with the family sitting around, eating dinner.  So having the most perfect surround sound or whatever is not a top priority for me.  So generally I drop that out and go for nice, regular audio instead (my main viewing area is stereo only, not surround sound anyway.)

We have three tabs about which we really need to worry for our settings: “Picture Settings”, “Video” and “Audio & Subtitles”.  The other tabs can be ignored, at least until you are really, really comfortable with making Handbrake tweaks.

Picture Settings. Leave the “crop” section alone, Handbrake is good at auto-detecting this.  I have never needed to modify it myself.  Under “Anamorphic” you will want to choose “Loose” if you have a widescreen/letterbox movie or chose “None” if the movie is Full Frame (when in doubt, use Loose.)

If the movie was a cinema movie (as opposed to a “made for TV” movie) then I turn on “detelecine” but check my note below about framerates before you do this.  I always turn on “decomb” and set “deinterlace” to “slower”.  I set “denoise” to medium and, for live action film, set “deblock” to 5.  If it is a cartoon rather than live action I turn off “deblock”.

Video.  The “Video Codec” should always be “h.264”.  This will be the default so you can just leave it as it is.

Framerate is tricky.  Movies made for the cinema are normally in 23.976 frames per second and so you will get better quality if you detelecine and take the framerate back to its original.  Many television shows made before the mid-1980s were done directly to film and were 23.976 fps as well.  Today many good televisions are able to display 23.976 fps (they call it 24 fps or 1080p/24) while older televisions could not.  Mine does and so I convert all of my film DVDs back to the original framerate to increase the quality and to lower the file sizes.  If you are dealing with television content then I do not turn on detelecine and leave the FPS as “same as source” which will keep it at the 29.97 of normal DVD NTSC.  If you do not have a television capable of showing 24 fps then you might want to consider keeping everything “same as source” and avoiding detelecining unless you are investing in future viewing assuming that anything new that you buy will be able to show 24 fps.

Under “Advanced Encoding Settings” I always use “2-pass Encoding” and I always turn off “Turbo First Pass”.  My goal with this process is to take more time but to get the best conversion process possible.  You should turn on “Grayscale Encoding” anytime that you are encoding a black and white film.  This keeps colour from accidentally popping into the picture when there should not be any.

Quality.  Now for the most subjective section.  I use non-constant quality because it gets you better storage to quality ratios at the expensive of not being able to predict streaming rates.  This is a no-brainer for a home network.  Constant quality is sometimes used in Internet streaming of video to make the experience more consistent even though it greatly increases your storage needs while reducing the overall quality of the video.  I avoid target size as well.  You can play with this if you want later.  I do all of my adjusting via “Avg Bitrate”.

For an average movie I tend to use a bitrate of 2400.  This is a good place to start.  If this looks plenty good when you watch the final movie try 2200 the next time.  Still good?  Try 2000.  You want to be just slightly higher than where you start to not like the image.  The lower the bitrate the smaller the final files.  If I am dealing with a high detail cartoon, like a Disney cartoon movie or Studio Ghibli, I will lower the bitrate to around 1000 and if it is a low detail cartoon like Family Guy or the Simpsons I will go to 850.  At 850 the deinterlacing process actually allowed Family Guy to look better after conversion even with the file size cut to around 10% of the original files!  This really shows what a bad job the DVD format does for modern videos.

Audio & Subtitles. Not too much to worry about in this section.  If you have a subtitle track selected you can choose it here.  Be aware that subtitles in Handbrake and permanently burned into the final product.  They are not a subtitle channel that you can turn on and off.  So pick wisely.  Generally I burn on English subtitles for foreign language films but leave them out for anime but include both English and Japanese audio so that I can watch the original performance while still enjoying the artwork unencumbered by subtitles.

Under Audio Tracks you will choose the audio that you want recorded and what settings you want.  Generally you will have only a single track to include although you can include many if you want.  You can choose to which track you will listen when you are viewing your movies.  This could include the regular English track, a commentary track, the uncompressed AC-3 English track and a French language track.  That’s fine.

For me, I almost always just use the standard English track, encode as AAC, mixdown to Dolby Pro Logic II, Sample Rate set to Auto and Bitrate set to 160.  DRC is left at one, this is an advanced feature that you can play with later.  My system does not provide any digital surround sound.  For me, for most movies, it just isn’t important.  But for a lot of people it is.  To do this I always go ahead and still do my main track (track 1) just as described but then I also include a second track from the same source but with my Audio Codec set to AC3 rather than to AAC.  This causes Handbrake to simply include the original soundtrack exactly as-is so the digital surround sound folks can get the original audio exactly the same as on the DVD.  I like to include both because there are a lot of playback systems that do not handle AC3 very well that will play the AAC without any problem.  The AAC track is a bit smaller than the AC3 track so once you are including AC3 you might as well include the AAC as well.  I would definitely record things like commentaries as AAC to save space as their sound quality is never very good nor important.

All Done. That is it.  That is all that you need to know to get a good starting point in Handbrake.  Now that you have all of your settings filled in for your first movie just hit the “Start” button and Handbrake will begin encoding your first movie.  This will take a few hours.  Possibly many hours.  This is highly dependent upon the power of your computer and if it is busy doing anything else at the same time.  You might want to just let it run overnight.  You can check out your creation in the morning.

Step Two (CD)

In addition to compressing DVDs and other video formats for use on your new home network media system you can also compress your CD collection into the handy MP3 format so that you can play this on any device in your home.  You can also buy MP3s directly from Amazon that are not encumbered by DRM like downloads from the Apple iTunes store so that you can use them however you like.  Amazon downloads are both higher quality and less expensive than Apple’s encumbered downloads.  There is no upside to buying from Apple.  With Amazon you actually own the files and are not just paying to “borrow” them from Apple.

If you have Amazon MP3 downloads (or any other MP3 downloads) you can use them directly and do not need to do anything with Step One or Step Two.  Go directly to Step Three.  This step is for converting CDs to MP3 format.

The best software that I have found for this process is CDEx.  Using CDEx we can rapidly put in a CD and have it turn out a complete set of MP3s in no time with almost no interaction from us.  It is fast and easy.  Far easier than converting DVDs.

At this time I am going to leave out the complete directions for converting using CDEx.  Needless to say, set your encryption to MP3 using LAME, setup your email address with the FreeDB settings so that you can download CD information automatically, pop in your first CD and let CDEx work its magic.  I suggest using the very highest quality variable bitrate settings that you can for MP3 encoding.  We have so much cheap storage space these days and you want your music to sound as good as possible.

Step Three: Serving Up the Media

Now that we have h.264 video files (well, one file at least) and some audio MP3 music files we can set up our media server and test out our system.  Keep in mind that the “coolness” and useful of this system grow rapidly as you introduce more and more media files to it.  Once you have converted your DVD and CD libraries and no longer need to ever go to them in order to reach your movies and music from around your home suddenly the system because extremely useful.

For my own system I have decided to go with a dedicated media server, an HP Proliant DL185 G5, running OpenFiler and MediaTomb to server out my video and audio files.  Given the scale at which my system works this is a really good investment for me.  Down the road you may find a similar system to be worthwhile for you as well.  The DL185 can, at the time of this article, scale to 28TB of storage in a single, smallish server.  If you have a lot of movies this can be a great investment, especially when you consider that you can run RAID (redundant drives so that you don’t lose your data if one drive fails) which helps to protect your movie collection from drive failures.

For our purposes, we will assume that you are going to start using your system via a Windows desktop.  Likely you will want to invest in a minimum of a 1.5TB USB connected hard drive that you can use to store your movies.  Ideally you will also have some backup mechanism – possibly just a second drive on the same machine to which you can copy the files once per week or so.  But you don’t need that to get started.

The software that is easiest to use on Windows and that works very well is ps3mediaserver.  This software does not work on the large OpenFiler system that I am running, mostly because it attempts to do many things that I do not need.  For beginning users it is ideal.  Like all of our other software pacakges, it is free.

Install ps3mediaserver on your Windows desktop.  The default configuration should actually work immediately as soon as you turn it on.  It really is that simple.  There is one additional step that we need to perform, however, because of the way that we have done our transcoding.  In ps3mediaserver under the “Transcoding Settings” tab, under “Misc options” we need to enter “mp4, m4v, mp3” on the line that says “Skip transcode for following extensions (coma separated):”.  The reason that we do this is because the ps3mediaserver people assume that the files being served up for viewing on the network are a random assortment of video files that are poorly compressed and not prepared for viewing on the Sony PS3.  For us this is not the case.  We have painstakingly prepared our videos so that we could store them small and get maximum quality out of them.  If you allow ps3mediaserver to transcode itself it will take the long Handbrake process that we have done so carefully and do it “again”  and will do it on the fly while you are watching the video.

By transcoding on the fly we have several problems.  The first is that our videos are already in the exact format that we want for maximum quality.  Why would we want to make them worse?  The second is that our desktop will be working extremely hard while we watch movies rather than doing almost nothing.  If we do not transcode on the fly then our single Windows desktop should be able to server out many movies at the same time.  Not so if it is busy transcoding.  The third is that the good transcode done by Handbrake takes an idle computer easily six to ten hours to do.  That same work is them done in the ninety minutes of a normal movie’s playtime when transcoding on the fly.  That means that only one quarter or less of the “effort” is put in to making that movie look good.

The bottom line is that on the fly transcoding is sometimes necessary when movies are not prepped ahead of time but unless absolutely necessary because movies will not play without it, it should be completely avoided.  All it will do is make your entire experience far less than optimal.  It will also introduce new playback problems to your movies such as issues with fast forwarding.

So, once we have disabled transcoding we are good to go.  Click “Restart HTTP Server” and everything should be working.

Putting It All Together

Now that everything is set up you can go to your Sony PS3 which is, I hope, connected to your home network.  Under the video menu you should see the new ps3mediaserver running on your network.  You can navigate to it and through its menu system you should be able to find the movie that you just transcoded.  Click on it and, if all went well, it will start playing instantly.  Welcome to the world of the networked media server.  As you add movies, television, podcasts, photos and music to your system it will continue to become more and more useful.

In theory, using ps3mediaserver you will also be able to stream, automatically, to the XBOX 360 in addition to the PS3.  I have no yet been able to test this but will report back when I do.

There are many other devices other than the XBOX 360 and the PS3 that can play these videos over the network.  On the computer I use the VLC Media Player to watch the videos directly.

Adding Internet Content

Now that you have your own video and music content on your network you can now consider doing away with your streaming television content that you get from cable or satellite.  Check out the PlayOn software available from The Media Mall.  For just $40 you can get this software that also runs on your Windows desktop – it will run alongside ps3mediaserver – and it will make online streaming video sites like Hulu, CBS, ESPN and YouTube available to both your PS3 and your XBOX 360 so that you can get all of that great video on demand content through the same system as your home video collection!  If you have a NetFlix account this entire system becomes even more awesome as NetFlix On Demand (Play Instantly) offerings, which include a ton of content like shows from the Disney Channel, as NetFlix will play through PlayOn as well.

Having both your own media server and PlayOn together is an amazing combination.  No more need for DVD players, CD players or stacks of discs sitting around to become lost or scratch and no more searching for the CD that you want just to listen to one song.  It’s an “on demand” system that is very addicting.

Leave a comment