Archive for the ‘iTunes/AppleTV Video Server’ Category

Video Server, Part 4: Converting

Monday, September 24th, 2007

This is Part Four of my series on building a video server using Apple’s iTunes/AppleTV combination. This article details the process of converting existing video files to a compatible format.

When I initially started this whole video thing, my goal was to get video on my iPod, so naturally one of the applications I came across when I was searching for tools to convert my collection of .avi files was the Videora iPod Converter by Red Kawa (v2.25). Though billed as an iPod converter, this front-end for ffmpeg allows you to set the output values to almost anything, making it ideal for converting an existing .avi file to any flavor of .mp4 you’d like.

At first I was put off by the ad-thick interface and the hideous design, but once I got past that I found a fairly full featured, functional application. Day to day usage is trivial, as the program is built around a “One-Click” queue that functions pretty much as intended, but getting it configured took a bit of work.

Step 1: Set the Video Output Folders.
After you start the program, choose “Settings” from the menu at the top of the screen. Chose “Devices” from the tabs menu that appears, then “iPod” from Device Settings. You have two fields for Video Output Folders: MPEG-4 Videos and H.264 Videos. I don’t know which is which, so I set both of them.

Fig 1: Set the Video Output Folders.

Step 2: Set the Encoding Profile and One-Click settings.
Change the tab from “Devices” to “Converter”. In the “Encoding Profiles” box, set Device to iPod, and Profile to “H.264 VGA 1024 kbps Stereo/160kbps”. In the “One-Click” box, set “Device” and “Profile”. I also set “Process Priority” to “High”, but this is the only thing I use this computer for.

Fig 2: Set the Encoding Profile and One-Click settings.

Step 3: Edit Profile, set General Properties.
Click on “Edit Profile”. Leave Name set to “H.264 VGA 1024 kbps Stereo/160kbps”, and change Encoder to “AppleTV 1-Pass – FFmpeg MINB”, if it’s not already set.

Fig 3: Edit Profile, set General Properties.

Step 4: Edit Profile, set Video Properties.
Click the “Video” option in the menu, and set the options as they appear in Fig 4. For the most part, I prefer to leave the resolution and aspect ratio alone, and make sure Auto Resize is not enabled. However, do make sure to set the Framerate value to “29.97”. A number of applications and hardware decoders can be touchy about this value.

Fig 4: Edit Profile, set Video Properties.

Step 5: Edit profile, set Audio Properties.
Click the “Audio” icon in the top menu, and compare the settings to Fig 5. To be perfectly honest, I don’t remember whether or not I changed any of the defaults, or if they matter.

Fig 5: Edit Profile, set Audio Properties

Step 6: Convert.
Once the profile has been configured, converting is a breeze. In the top menu click “Convert” and choose the “Current Conversion” tab. Click the “One-Click Convert” button to choose a list of .avi files. They will automatically be added to the queue and conversion will begin immediately. Completed files will be dropped in the Video Output Folders defined in Step 1, and should be fully iTunes compatible.

Fig 6: Convert.

Your mileage will vary, of course, but my conversions are usually a tad faster than realtime. A 42 minute file, for example, will usually take 30 to 40 minutes to complete, and the quality, while not stellar, is adequate. There are likely a number of places where this could be improved.

In the next article in this series, I will present the scripts and techniques I use to add meta-data to the video files, including plot descriptions, artwork and ratings.

Video Server, Part 3: Encoding

Friday, September 14th, 2007

This is the third in a series of articles that will detail the tools and methods I’m using for my personal media server at home. Part 3: Encoding gets to the meat of the matter, and finally addresses how to turn the DVD into a video file. Future articles will detail converting, integration and disaster management.

Encoding is where all magic happens. The data on the DVD is finally converted to a standalone file to be used in other applications. This is also where most of the confusion lay, where incompatibilities creep in, and where most of the time is spent waiting for the computer to finish something. This time spent waiting is also what makes trial and error such a bitch; depending on your setup, you may have to wait as long as four hours to find out if the file you generated is any good, or if it will work in with your chosen application.

Right up front, let me say that I’m no expert on this subject. I had one goal: decent quality movies at a reasonable size that worked in iTunes. There are a ton of videophiles out there who argue about this codec or that codec, and Dolby digital sound vs. whatever regular old sound is called, but when it comes down to it, I’m interested in convenience and watchability above all else. That being said, though, this method produces a file that’s indistinguishable from DVD, at least to my eyes.

One more caveat, before I delve into the minutiae. I’m going to go through all of the options I set for encoding, but there are a number of places where I didn’t make a conscious decision to do it one way or the other, and I don’t know if changing it will make any difference. For example, in one case I turn auto-cropping on, because I suspected that leaving it off would give me black bars along the top and bottom of my image. I never tried changing it, though, because the settings I’m using give me the results I want.

I played around with a number of different packages on both Mac and PC before I finally ended up using Handbrake v0.9.0 on the PC, a free, open-source, cross-platform package that used to be exclusively for the Mac, but eventually went both ways. It’s not super-fast, but it produces an excellent quality video and is fully operational from the command line; in fact, from what I can tell the GUI is just tacked on to make it easier to build the command line parameter list. In the interest of gratuitous multi-media, however, I’m going to go through configuration using the GUI before recommending you abandon it altogether.

Step 1: Choose your source directory.

The first step, once you start the program, is to choose the directory where you stored your DVD rip. You can find more information on ripping in Part 2 of this series. This example is based on where the files would be after following that tutorial, or F:\FullDisc\JURASSICDTS\VIDEO_TS\.

Fig 1: Choose your source files.

Step 2: Choose AppleTV from the presets:

From the menu bar, choose AppleTV from the preset menu. This will set a number of options.

Fig 2: Choose AppleTV from the presets.

Step 3: Choose the destination and cropping options.
When you specify the destination file through the Browse menu, Handbrake will automatically change the file extension to .m4v, the default file extension for Apple’s movie files. Since a number of my post-encoding scripts were written to use .mp4 files, and I have hundreds of other files with that extension, I change it back to .mp4. This seems to work fine. Under the “Picture Settings” tab, set Cropping to “Auto Cropping”.

Fig 3: Set the destination file and the cropping.

Step 4: Change the bitrate.
Change to the “Video Settings” tab and change the bitrate to 1024. I’ve found this bitrate produces excellent results and a file size of around a Gig for most movies. As far as I know, the value 1024 has no special meaning in this context- it just seemed computer-y.

Fig 4: Change the bitrate.

Step 5: Ditch the GUI.
The last tab, “Query Editor”, has button labeled “Generate Query Now”, which will give you the command line options based on your settings. I recommend you copy this text and run Handbrake from the command line:

C:\Program Files\Handbrake\hbcli.exe -i "F:\FullDisc\JURASSICDTS\VIDEO_TS" -o "E:\Upload\Jurassic Park.mp4" -e x264 -E faac -p -m -b 1024 -x bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2 -B 160 -R 48

… or, if you’re running Cygwin, which I also recommend:

/cygdrive/c/Program\ Files/Handbrake/hbcli.exe -i "F:\FullDisc\JURASSICDTS\VIDEO_TS" -o "E:\Upload\Jurassic Park.mp4" -e x264 -E faac -p -m -b 1024 -x bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2 -B 160 -R 48

Fig 5: Generate the query if you want to run it from the command line instead

At this point you’ve got a nice file that you can drag into iTunes and watch on your AppleTV. A word of caution, though: on my machine, this process will occasionally fail with a segmentation fault after two to four DVDs. Rebooting and restarting the process works for me.

In the next entry in this series, I will go deal with converting existing files into MP4 files, mostly for dealing with downloaded TV Shows, and after that I will address adding meta-data, such as artwork and plot descriptions, to make your videos pretty. Stay tuned for that- there will be scripts.

Video Server, Part 2: Ripping

Saturday, September 8th, 2007

This is the second in a series of articles that will detail the tools and methods I’m using for my personal media server at home. Part 2: Ripping is all about getting data off the DVD and onto the computer. Future articles will detail encoding, converting, integration and disaster management.

Note: For the record that I believe ripping data from DVD movies you do not own is illegal, and I do not support it.1 If you enjoy a movie, buy it, and support the people who created it… even if entire industry is a bunch of greedy douchebags.

For a while, I didn’t even realize ripping was a thing. I was playing around with different encoding tools, and they all worked the same way: stick the DVD in, twiddle some stuff, and the program read from the disc and wrote to a file. Most of the time, this worked. More and more often, though, I would encounter a problem; either the problem wouldn’t ready my disk, or it would encode about 20 seconds of data and hang. After some research, I eventually discovered something I already knew: most DVDs are encrypted. This is why you can’t just put in a disc and copy the files off it, even though if you explore you can see them clear as day.

I found the solution was a separate program designed to read the DVD and store an unencrypted copy on the harddrive. After some trial and error, I’ve had great results with DVDFab HD Decrypter. Not only is it free and reliable, it’s dirt simple.

Ripping the data to the hard drive separately also has additional benefits: it may cut down on the wear and tear on the DVD-Rom2, as ripping takes considerably less time than encoding, and after the initial rip, you can encode without having to be physically present at the machine, or re-encode if something goes wrong.

DVDFab HD - 1

Insert the disc, wait for the chapter data to load, and hit “Start”. If it’s the first time you’re running the program, also specify the Target: directory.

DHDFab HD - 2

The process usually takes between 10 and 20 minutes.

Afterward, you will find a subdirectory in the FullDisc directory in the Target directory: <Target>/FullDisc/<DVD>. In the above example, the data I want is in F:\FullDisc\BLUSBRO\VIDEO_TS\.

I don’t do a lot of ripping on the Mac, but the few time I have, I’ve had good luck with Mac the Ripper.

Next Up: Encoding.

  1. I am not a lawyer, so I don’t know this for a fact. I think I saw it online and I’m repeating it here just in case it’s true. []
  2. I also have no proof of this, it’s just one of those things that seems true. Maybe reading from a disc for 15 minutes at full-bore does more damage than reading a few bits at a time for two hours. []

Video Server, Part 1: Hardware

Tuesday, September 4th, 2007

This is the first in a series of articles that will detail the tools and methods I’m using for my personal media server at home. Part 1: Hardware gets the ball rolling with an in-depth look at the physical devices that power my system. Future articles will detail ripping, encoding, integration and disaster management.

wilbur.jpgThe heart of the system is Wilbur, a 1.42 Ghz G4 Mac Mini with 1G RAM. I’m not ashamed to admit that I love this little guy. It’s quiet, reliable, Unix-based, and it’s never given me an ounce of trouble. That being said, though, it could be faster. While fine for day to day tasks, and a great desktop, it just can’t cut it when it comes to the heavy lifting. Enter Clyde.

ClydeClyde is an Intel 2.8 Ghz P4 with 1GB RAM, running Windows XP. Clyde is not super fast, but he’s faster than Wilbur, so I use him for ripping and encoding. In addition to saving me time, using Clyde instead of Wilbur means I don’t have to tie up the machine I actually like to use.

CoolmaxEach machine has a 500GB SATA HDD. Clyde’s is internal, but Wilbur’s drive is mounted in an external FireWire enclosure. This setup has proven not only fast enough to stream video, but substantially faster than the internal drive. I’m currently using an enclosure from a company called Coolmax. It’s ok, but it will eventually get phased out, in favor of another solution that has an added FireWire port for daisy-chaining… and better matches the aesthetics, of course.

AppleTVThe final piece of the hardware puzzle is the AppleTV. This is the box that connects the TV to the network, and streams music, video and photos from a machine running iTunes. It’s slick, it’s easy to install, and it works great. One thing to be aware of, however, is that it only works with HDTVs.

Up next: Ripping.