How-To: play DivX and Xvid on your Apple TV

ATVFiles Apple TV plugin

The two biggest Apple TV limitations are the lack of codec support (like XviD, DivX, etc.) and not even having the ability to do basic surround sound like Dolby Digital 5.1. These issues were resolved almost immediately after the Apple TV was released, although the hacks were somewhat less than practical. Something as simple as getting your Apple TV to, say, sync and recognize your XviD movies as playable was no simple feat. Thankfully, that's no longer the case, and we want to show you how to get the most out of your Apple TV. Who says you can't have your cake and eat it, too?

Before we get started we would like to applaud the entire crew from AwkwardTV, if it wasn't for their great Wiki, we may not have figured all this out.

Warning: you're about to engage in some serious, potentially warranty-voiding hacking. Just the way you like it, right? Ready to get your hands dirty? We need to download a few files first.

Download - ATVFiles plugin.
Download - Perian, the swiss army knife of QuickTime codecs.
Download - A52Codec, an AC3 codec.
Download - Custom ssh.plist file to start sshd automatically.

Download - Fugu, a nice OS X GUI to transfer files to the Apple TV.
Download - WinSCP to a nice Windows GUI to transfer files to the Apple TV.
Download - If you don't have an Intel Mac, you will need this Intel version of sshd.

Materials needed
A Mac of some sort - Sorry, you've got to be able to read the Apple TV's drive to at least get sshd going.
other stuff here.

We are going to do this in two steps. For those who do and do not already have SSH enabled. So if you've got SSH running on your Apple TV, skip ahead to the next section.

Enable SSH on the Apple TV (requires a Mac)

Remove the drive the same way we did to expand the drive and plug it into a Mac, then launch Terminal. Our first command is going to copy the Intel version of ssh daemon from our Mac to the ATV drive. If you are on a Intel Mac copy it from your sbin directory to the ATV's OSBoot/usr/sbin/ directory. If your browser causes the line to wrap be sure to enter it on one line in the Terminal.

sudo cp /usr/sbin/sshd /Volumes/OSBoot/usr/sbin/

You can also copy it from your downloads directory:

cp /Users/Engadget/Downloads/sshd /Volumes/OSBoot/usr/sbin/

Make sure sshd is executable
sudo chmod +x /Volumes/OSBoot/usr/sbin/sshd

Backup the original ssh.plist to our home directory:

cp /Volumes/OSBoot/System/Library/LaunchDaemons/ssh.plist ~

Now copy the new one from our downloads directory to the Apple TV drive:

cp /Users/Engadget/Downloads/ssh.plist /Volumes/OSBoot/System/Library/LaunchDaemons/

Before we dismount the drive to reinstall into the Apple TV, let us see if we need to clean up after Spotlight again.
Perform these command and check if the .Spotlight files are on the partitions by typing:

ls -a /Volumes/Media


ls -a /Volumes/OSBoot

Now, if you do see those .Spotlight files, use the following command to remove them. But be careful, this is the dreaded rm -rf command, which has the potential to ruin everything.

sudo rm -rf /Volumes/OSBoot/.Spotlight-V100


sudo rm -rf /Volumes/Media/.Spotlight-V100

Now dismount the drive and install it in your Apple TV. If you need to give your friend's Mac back, feel free. From here on out you can fly PC on this op, if you so choose.

Test it by signing in via terminal. (The password is frontrow.)

ssh -1 frontrow@AppleTV.local

That should get you in. So let's start installing the good stuff, shall we?

Adding additional QuickTime components.

Before we can start copying files we need to ssh into the Apple TV and mark the volume as read / write. A few times we will use sudo (as in sudo make me a sandwich) and a password will be requested; it's also frontrow. From the terminal, ssh to the Apple TV:

ssh -1 frontrow@AppleTV.local

Now remount root as read / write. (Enter frontrow for the password.)

sudo mount -o remount,rw /dev/disk0s3 /

At this point you can use Fugu (our scp file transfer frontend) if you prefer. Otherwise, use the commandline scp to copy the following files to the Apple TV. But before you can preform this step you need to mount all the DMGs you downloaded and uncompress ATFiles so you can have the necessary files handy.

Now, copy the ATVFiles plugin, Perian and AC3 QuickTime components to the Apple TV. (As always, depending on the location of these files your command will differ.)

scp -1 -r /Users/Engadget/Downloads/ATVFiles-0.2.1/ATVFiles.frappliance/ frontrow@AppleTV.local:~
scp -1 -r /Volumes/Perian\ 0.5/Perian.component frontrow@AppleTV.local:~
scp -1 -r /Volumes/A52Codec\ 1.7.2/A52Codec.component frontrow@AppleTV.local:~

If you have the MPEG-2 QuickTime component then you can copy that too, but otherwise it's probably not worth the $20.

scp -1 -r /System/Library/QuickTime/QuickTimeMPEG2.component/ frontrow@AppleTV.local:~

Now we need to use ssh to move the files to the proper directory so QuickTime can find them.

ssh -1 frontrow@AppleTV.local
sudo mv ATVFiles.frappliance/ /System/Library/CoreServices/
sudo mv Perian.component/ /Library/QuickTime/
sudo mv A52Codec.component/
sudo mv QuickTimeMPEG2.component/ /System/Library/QuickTime/

Now we need to restart Finder so it will load the plugin, you could pull the power (easy way) or you could run a couple commands (slightly less easy way). Here those are, if you're paranoid about unplugging your unit; find the pid to kill:

ps ax | grep Finder

This will return a line with the pid for finder.

Finders Pid

Now kill Finder's pid. (Ours was 512 when we wrote this.)

kill 512

After Finder restarts we will see a new menu item named Files, which allows us to play movies stored in /Users/frontrow/Movies on the Apple TV. So we'll copy a movie there, shall we? (Again you can use scp, or Fugu if you prefer.)

scp -1 ~/Movies/Gothika_480p_XviD.avi frontrow@AppleTV.local:~/Movies/

All you have to do is select the clip to play from the files menu.

Voila! Your Apple TV just got a whole helluva lot more useful.

Of course there are many more codecs that work by using the same basic method of installing QuickTime plugins into the ATV's directory structure. And don't even get us started on all the other plugins being developed for this bad boy. Hell, you can even mount AFP or NFS shares and stream videos instead of copying them. The possibilities are kind of endless for this little Unix box, but hopefully this guide well get you on your way. Good luck!