Aug 11 2008

Changing the Startup/ Intro movie on an AppleTV Take 2

Published by Jonathan Wise under Hacks

The original AppleTV software had a beautiful startup movie (startup.mov) that I loved. It, along with many other nice features of 1.x were replaced in the Take Two update. Granted Take Two brought a lot of new functionality with it, but I still mourn the simplicity and elegance of the 1.x software. The new startup movie (Intro.m4v) particularly bugs me. So I decided to do something about it.

First, I found and extracted the original Startup.mov from a little bundle I’d pulled together a few years back to try to make my Mac Mini more like an Apple TV. Then I went hunting for where Apple had stashed its replacement in the Take Two firmware. You can find it here:

/System/Library/CoreServices/Finder.app/Contents/Resources/Intro.m4v

Note that they moved from using an MOV to using an M4V file for the movie. I messed around with trying to convert the original MOV into an M4V, but everything I tried was too lossy. By the way, the “Export for AppleTV” setting you find in Mac software that supports it does not export to the highest bit rate that the AppleTV is capable of — it actually can handle up to a 6500MBPS combined bit rate.

So I tried Export in QuickTime, I tried all the different settings in FFMPEG, but I still wasn’t happy with the result. So I decided I’d try a Symlink instead, to fool the AppleTV into playing the file I wanted. Note that you could do this with any movie file the AppleTV is capable of playing, so you can customize your start-up to your heart’s content! Here’s the steps I took. You’ll obviously need a patch-sticked AppleTV to do these steps:

  • Copy over (using SCP/Fugu/WinSCP) the startup.mov file
  • SSH into your AppleTV
  • sudo bash
  • mount -uw /
  • cp ~/Startup.mov /System/Library/CoreServices/Finder.app/Contents/Resources
  • cd System/Library/CoreServices/Finder.app/Contents/Resources
  • mv Intro.m4v Intro-Take2.m4v
  • chown root:wheel Startup.mov
  • ln -s Startup.mov Intro.m4v
  • reboot

When its done booting, you should see the new (old) startup movie! All we’re doing here is copying in the original movie, backing up the existing one, fixing any permission problems, and creating a Symlink so that when the boot process goes to open Intro.m4v its redirected to Startup.mov!

Symlinks have to be one of the coolest things about using a Unix-based OS…

No responses yet

Jul 22 2008

Using PHP and a Shell Script to Restart an AppleTV remotely — via the web

Published by Jonathan Wise under Hacks

As a follow up to my previous post, here’s how to do the same thing, but from a web browser (say, on your iPhone) — it assumes you’ve already written a shell script, as discussed earlier.

  • Configure Apache to run PHP on your Mac (these instructions are for Leopard, but similar ones are out there for Tiger)
  • Configure Apache to run as your own user, instead of the WWW user — a serious security risk. Only do this on an internal network! The WWW user won’t have adequate permissions to do what we need to.
  • Put this .php page in your /Library/WebServer/Documents/ folder as RestartMedia.php — you’ll need to supply your own image file in the same path as well.
  • Visit http://yourcomputer.local/RestartMedia.php from a browser. Clicking on the text or image will execute a shell script located at: /Applications/Automation/RebootMediaServers.sh

Obviously you can customize this at will, including file locations. This was just a quick hack that does the job for me — and the webpage is optimized for Mobile Safari.

No responses yet

Jul 21 2008

Using AppleScript and a Shell Script to Restart an AppleTV remotely

Published by Jonathan Wise under Hacks

Both my media serving devices (a NAS, and a Mac Mini) are using TwonkyVision Media Server to share media using uPnP. It works great, but as I mentioned earlier, I needed a script to make it start back up in the morning.

Unfortunately, I’ve found that my AppleTV freaks out a bit when this happens, and as a result, needs its own reboot. Restarting the Finder helps, but streaming still gets weird, so a full, daily reboot is in order. Using the same iCal-alarm-firing-an-AppleScript trick, I updated my Twonky restart script to also tell the AppleTV to restart. But it wasn’t that easy.

  • First of all, you need to exchange keypairs with the AppleTV so that you can login over ssh without a password. However, the process is a little different, since the AppleTV only supports ssh1. This wiki page explains the process, and the slight tweak to it for ssh1.
  • Second, you need to set the AppleTV up to allow you to sudo without a password. This is harder than it sounds, and requires modifying the /etc/sudoers file on the AppleTV. The only way I found to do that was to sudo cat > ~/sudoers the file (which dumps the contents of one file to another, which you can access more easily), copy it over to my Mac, edit it, copy it back, set the permissions, and sudo mv it back over-top the original. You’ll need to add this line to the bottom of the sudoers file:
    frontrow ALL=(ALL) NOPASSWD: ALL
  • Make sure you change the permissions (0440) and ownership (root:wheel) on your new sudoers before you replace the original, or you’ll screw yourself out of sudo!

To test those things, you could go to Terminal on your Mac and try something like:
ssh -1 frontrow@appletv.local 'sudo ls-l'
If you’ve setup everything right, you shouldn’t get prompted for a password to login OR to get a directory listing. Once that works, the AppleScript is easy and looks like this:

do shell script "ssh -1 frontrow@appletv.local 'sudo reboot' &> /dev/null &"

At some point, I’m also going to attach this to a PHP script (somehow) so I can use Safari on my iPhone to do a reboot from the couch if needed. I’ve only found two other ways to reboot the AppleTV — yanking the power cord, or using the remote to put it in recovery mode. Neither seems as elegant as my solution.

No responses yet

Jul 10 2008

Hacking the AppleTV - Fourth time’s the Charm!

Published by Jonathan Wise under Hacks

So last night, after 4 passes, I finally got the AppleTV hacked to my satisfaction. I had to give up on a few features in the name of keeping things stable and easy for the family to use, but it does everything I really wanted it to, and runs smoothly…

This morning, they released the AppleTV 2.1 Update.

I did manage to get Nito TV’s Smart Installer and Turbo’s Kext Loader running in 2.0.2, but the result was a system so jam packed with stuff it wasn’t supposed to do that video play-back suffered badly. Here’s the steps I took, in case anyone else wants to try it:

  • Do a clean restore on your AppleTV. Any previous failed hacking attempts will confuse the installer.
  • Patchstick
  • Copy over the Nito TV Installer and run it
  • sudo bash then mount -uw / to get write access
  • Run Nito TVs Fix Permissions script: sudo /System/Library/CoreServices/Finder.app/Contents/PlugIns/nitoTV.frappliance/Contents/Resources/fixPerm
  • Make a directory called Documents in ~/
  • Copy the 10.4.9 Combo Update into that folder
  • Install Turbo’s Kext Loader via the Nito TV UI on your AppleTV
  • Run the Smart Installer
  • Assuming it succeeds, now download and run this guy’s script to fix AFP
  • You’ll probably also need to fix permissions on the AppleShare stuff
  • Then try a manual mount: mount_afp -i afp://user:password@192.168.1.110/media /Users/frontrow/Movies/
  • If that works, you’re in business! Reboot to clear that mount, and check out Sapphire to load content from your mounted folders.
  • Finally, install the MPlayer Codecs from the NitoTV UI

Also, I do not recommend installing Perian via the Nito TV menu (its irreparably screwed up playback on me every time, and I’ve had to restore and start over!) Copy over your codecs from an Intel Mac if you can — including Flip4Mac, DivX Import, AC3 Import and the AC52 Audio Component.

Now about 2.1…

Running the 2.1 update did clean-out my hacks. I was hoping it was an install-in-place sort of deal, and it wouldn’t mess with anything it didn’t need… too bad. Here’s what I tried:

  • Re-run the Patchstick: Success!
  • Install Nito TV: Fail — puts the Finder in an endless start-up loop
  • Restore to 2.0.2 re-run the Patchstick, run the update to 2.1: Success
  • Install Home MediaCloud: Partial Success… the Finder menu item shows up, but accessing it causes a Finder reboot.

So, for now at least, I’ll have to wait for 2.1 update (and the ability to control my AppleTV with my iPhone) but I guess that’s alright.

Update on 2.1

  • Still no luck with Home MediaCloud, and no luck contacting its author. However, NitoTV is updated and working in conjunction with Sapphire Browser. Its cludgey, compared to the uPnP approach, but I’m working on how to refine it.

No responses yet

Jul 09 2008

Restart TwonkyMedia after scheduled sleep

Published by Jonathan Wise under Hacks

In our house, a Mac Mini serves at the content library and retreival machine. It runs a Torrent client, iTunes, and TVShows to collect and organize all our media. At night it runs a number of scheduled tasks to keep things orderly and fresh, and when its done (at about 4:00am) it goes to sleep until 8:00am when my wife will want to use it again.

TwonkyMedia server, which is delivering our non-iTunes content onto the AppleTV (via the MediaCloud uPnP client) has a problem with this. It doesn’t recover well from sleep.

The solution is to run an AppleScript every morning at 8:01 to re-start TwonkyMedia. This little AppleScript will access Twonky’s built-in shell script to shut down any running instances, and start-up a fresh one:

do shell script "/Applications/MediaServer.app/Contents/MacOS/twonkymedia.sh &> /dev/null &"

The “&> /dev/null &” sends the shell script’s output to oblivion so that AppleScript doesn’t hang waiting for the server to start-up.

The only annoying part about this is that every time TwonkyMedia starts up, it wants to take you to its home page in your browser. Follow these directions to make TwonkyMedia start-up silently (last post on the page.)

No responses yet

Jul 07 2008

Scattered notes on hacking Apple TV 2.0 (aka Take Two)

Published by Jonathan Wise under Hacks

  • Useful bash commands:
    sudo the whole session:
    sudo bash

    mount file system as read/write:
    mount -uw /

    remove a whole directory recursively (be careful!):
    rm -r /folder

    modify Hosts file to prevent the AppleTV from reaching the Update server…
    sudo bash -c ‘echo “127.0.0.1 mesu.apple.com” >> /etc/hosts’

  • Don’t bother trying to get AFP or SMBFS working in 2.0.2. Even if you put in the missing executable from a Tiger install, and the missing library files, it still won’t work. Turbo’s Kext Loader runs, but the kexts won’t work in 2.0.2.
    Just live with SSH and SCP. A front-end like Fugu will make things a little easier. Will need an uPnP server to get content from another source.
  • Although its possible to build a Patchstick without a Tiger install, its not worth the effort. Install Tiger (on an Intel Mac), and make sure you update to 10.4.9 — otherwise you’ll be missing components the Patchstick creator needs.
  • Built a working Patchstick using these directions from the AwkwardTV Wiki.
    I used a 128MB USB key — tried using an old iPod Shuffle (512MB) but it wouldn’t boot.
    Execute createPatchstick with no switches to find with disk# to use for my USB stick.
  • Trying out NitoTV as an additional media player — most stuff works, some doesn’t on 2.0.2.
  • Trying out MediaCloud as a uPnP media finder. It works great.
  • Most of iClarified’s AppleTV tutorials are out-of-date/work for 1.x only :-(
  • Need to get the audio component of the AC52Codec into /Libary/Audio/Plug-Ins/Components to get those high quality DivX rips working with sound.
  • Twonky Media is a decent multi-platform uPnP server for getting content from a Mac onto the AppleTV. Costs about $30.

One response so far