Sunday, August 19, 2007

Apple TV: Getting Content

In Apple TV is a Winner! I wrote about my new Apple TV, which plays iTunes media files on my HDTV via my wireless home network. Playing movies is one of its strengths. But where do the movies come from?

Apple would like you to buy movies and TV episodes at the iTunes store and download them into iTunes. But the selection isn't great yet.

Another option is to rip DVDs you own into iTunes-playable format using HandBrake. I covered that in my previous post as well as in some of the earlier posts in my Ripping DVDs category.

Yet another option is to download DVDs someone else has ripped and made available on the Internet. This can be more time-efficient, since you can only rip one DVD at a time but you can download several pre-ripped ones at once.

Of course, the download process can take a very, very long time ... but so does ripping DVDs yourself. With downloading, though, you can initiate several downloads and (if you like) go away and do something else. Hours later, you come back to your computer and (hope to) see that all your downloads have completed.

There are legal issues here. If you download a title that you own a copy of simply to avoid having to go through the dicey and tedious ripping process yourself, you will wind up with effectively the same media file you could have ripped yourself. You probably think that you would not be breaking the law. Well ... maybe yes, maybe no.

Making an archival copy of something you own is almost certainly legal — though there are laws against defeating digital content protection, which HandBrake does when it rips a DVD.

On the other hand, even if defeating the CSS copy protection on a copyrighted DVD for the purposes of making a personal archival copy is legal, taking the easy way out and simply downloading the same title, ripped by someone else from a different DVD, remains of dubious legality. Technically, you are not copying your own copy of the intellectual property represented by the DVD. You are copying someone else's copy of a copy which you do not own.

And if you download a copyrighted title you own no copy of, period, you certainly are breaking the law.

It's pretty easy to download movies for free, legally or not. One way is to use BitTorrent.

To use it, you don't really have to know that it is a peer-to-peer file sharing (P2P) protocol for distributing large amounts of data widely across cyberspace in a decentralized way. The general idea is that every file — movie or otherwise — is divided up into many, many, many tiny pieces, every one of which can be redundantly stored in different computers on the Internet. The pieces can be downloaded all at a time, in no particular sequence, from any of these locations. The BitTorrent client software that you run on your computer finds a source computer for each piece, downloads all the pieces one by one, and assembles them in their proper order to make a single file on your hard drive which is exactly like the original file.

The thing which describes all the pieces of the big file so that a BitTorrent client can access them is a small, information-containing pointer file called a "torrent." If you want to download, say, the movie Ocean's 12, you first need to find a website that publishes a torrent for that movie. Once you have gone to that site and clicked on the torrent, you click download, and your web browser downloads just the tiny torrent file.

You then open your BitTorrent client, if it's not already open and your browser doesn't automatically open it, and you point it at the downloaded torrent file, which is probably sitting on your desktop. After asking you where on your hard drive to put the big output file it is about to create, the BitTorrent client begins downloading the movie itself.

That can take a very, very long time. This is where the ability of a BitTorrent client to download multiple files pays off, for you can fire off multiple torrents almost as easily as one. They all download side by side. The BitTorrent client keeps you apprised of how much progress is being made for each file you are downloading.

Meanwhile — and this is interesting — once you have started obtaining pieces of a file, your computer becomes a BitTorrent "peer" for disseminating that same file. Other people who are trying to download the same target file can start obtaining (some of) their pieces from you.

The original BitTorrent client can be downloaded for free here, which is at the BitTorrent web site. It has Windows, Mac, and Linux versions.

I find a better choice for Mac users is BitRocket, which is likewise free. It is Open Source software: as many people as want to do so collaborate on its development, just for the fun of it. BitRocket has a much more usable interface than the original BitTorrent client, and it can also help you create your own torrent files.

I learned about BitTorrent and BitRocket from a useful post called BitTorrent 101 for Mac Users at MyMacBuzz.

Where do you find the torrents to download in the first place? First of all, there is the official BitTorrent site, where you can find a smattering of content that is guaranteed legal. Some is free, while some costs money to rent or to buy.

There are several other torrent sites I have found, much of whose content is presumably illegal:

The Ocean's 12 file you obtain from a torrent site is, sadly, not likely to be one that will play right away in iTunes or on Apple TV. It typically needs to be converted from an .avi file to an .mp4 file.

One way to do that is in QuickTime Pro on a Mac. If you open one of the .avi files you have downloaded in QuickTime Player, you can do a "Movie to MPEG-4" export, which will (slowly) convert the original movie to a new file in a format usable by iTunes/Apple TV. The old .avi file will remain untouched, while the new file, with .mp4 as its filename extension, can be imported into and played in iTunes ... which makes it available to Apple TV.

For all that to be possible, QuickTime must have access to the DivX codec, downloadable here. Or, some movies require QuickTime to use the XviD codec, available for the Mac from here. The XviD codec piggybacks on the DivX codec, so you need both.

Notice that the file format is not the same thing as the codec, also known as the encoder/decoder. The file format is .avi. The codec is DivX, or XviD, or whatever. (If it's "whatever," QuickTime may or may not be able to deal with it.)

When you want QuickTime Player to export a movie to MPEG-4, you select Export... from the File menu with that movie's window active in the player. In the Save As dialog, you choose Movie to MPEG-4 from the Export pop-up. You control exactly how the export is done by clicking on the Options... button.

From the Video Format pop-up in the MPEG-4 Export Settings pane, you will probably be best off choosing H.264, which results in the most advanced video compression available in the MPEG-4 family.

I'm currently entering a Data Rate of 1372 kbits/sec for H.264. I choose Current in the Image Size pop-up and also in the Frame Rate pop-up. I select Automatic for Key Frame, rather than telling QuickTime to shove in a so-called "key frame" every specified number of frames. (A "key frame" is an anchor point in a digitally compressed video stream: a single image that is entire unto itself and does not depend in any way on its neighboring images. The more often a key frame comes up in the digital stream, the better the video quality — at the expense of making the file less compact.)

In the MPEG-4 Export Settings pane, clicking Video Options produces a drop down sheet in which I am currently selecting "Restrict Profile(s) to: Main" and "Encoding Mode: Faster encode (Single-pass)".

Once you set all these MPEG-4 Export Settings up the first time, you can simply "Use: Most Recent Settings" from then on out ... unless you want to change something.

The typical movie export takes the better part of an hour to wrap up. Once it is done, you can add the resulting file to your iTunes library, and you're good to go.


Anonymous said...

Just as an FYI, is a known scam site - avoid!

Anonymous said... is the best one