Tuesday, December 21, 2010

Run DVDs On Apple TV using AirFlick and AirPlay!

The Unicorn has landed! Rainbows! Starshine! Skittle poo! It's like Christmas in...um...December! So why this exuberance and excitement? My Apple TV is right now, this very second, even as we speak, playing back a DVD of Finding Nemo. It's seriously awesome.

And it's not even all that hard to do if you're a bit of a do-it-yourself-hacker. Although, seriously, if the command line frightens and intimidates you, it's time to move on to the next Greenpois0n post.

Mac aficionado Erick van Rijk figured out how to use Video Lan Client to transcode a DVD in real time so that my AirFlick application could play it across to an Apple TV. The instructions, which you are heartily encouraged to follow only at your own risk, follow after the jump.

Okay? Deep breaths. Here we go.

Create a stream folder. If this is your first time doing this, create the following folder: /Library/WebServer/Documents/stream. You will need administrator privileges to do this.

Add MIME types. Similarly, for the first time through, you need to add a couple of MIME types for your Apache server. Edit /etc/apache2/mime.types and add the following two lines to the end of the file. (You should probably make sure they're not already in there.)

application/x-mpegURL m3u8
video/MP2T ts

Start your webserver. Hop into System Preferences. Open the Sharing pane. Enable Web Sharing. This establishes your Mac's built-in Apache web browser. You can test this by opening Safari and navigating to the name or IP address of your system, e.g. http://Banana.local or in my case. If you see "It works!" congratulations. Time for the next step.

Ensure that you have VLC installed. Make sure it's in your /Applications folder. (Both van Rijk and I used version 1.1.5.)

Determine the chapter you want to start playing from. Launch VLC and choose Open Disc. Choose a Title and Chapter (I went with 1 and 3, vanRijk chose 3 and 3. Your mileage will vary, so you may want to test first in VLC by clicking Open and see if the right bits play for you.) and check the No DVD menus box. Open the Media Resource Locator section and copy the dvdread locator (the "MRL") to a new file in TextEdit (or similar).

Fix up your URL. Paste the following command into TextEdit and modify it so the MRL matches yours; here it is dvdread:///dev/rdisk5@1:3-. The dash at the end is part of it. Don't mess that up.

/Applications/VLC.app/Contents/MacOS/VLC -vv dvdread:///dev/rdisk5@1:3- --intf=rc '--sout=#transcode{vcodec=h264,vb=2048,acodec=mp4a,ab=192}:standard{mux=ts,dst=-,access=file}' | mediastreamsegmenter -f /Library/WebServer/Documents/stream -D.

Run the command. Take a deep cleansing breath, launch Terminal, and paste that baby into the command line. A billion lines of VLC feedback should follow. Leave that running and hide the window.

Wait. It takes time to create the first few files (about 30 seconds or so).

Create your playback URL. The playlist file you need will be stored in the stream folder you created in the first step. Use the URL of your computer plus the stream folder plus the name of the playlist file to build the playback URL you need, e.g.:

Play your DVD using AirFlick. Download a copy of my AirFlick utility and run it. Select your Apple TV from the pop-up and paste that URL into the text field. Click Play.

Watch and Enjoy on your Apple TV. If you experience any interruptions (caused by read errors in VLC), just click the Play button in AirFlick again. The movie should start right back up.

Lather, Rinse, Repeat. Once you've gone through this exercise the first time, it's blindingly fast to get it going another -- especially if you save your command line instructions in a handy file.

Caveat Hackteur. van Rijk adds one final caveat, suggesting you avoid setting the media streamsegmenter to 1 second and stopping VLC because you can actually crash your Apple TV 2.

Aside from that, a big round of applause to van Rijk who put together such excellent and easy-to-follow instructions. Thanks, Erick.

For more news coverage, you can follow us on Twitter or become a fan on our Facebook page, we will keep you updated with posts over the web

No comments:

Post a Comment