Wise on Tech Hacks, scripts and ideas for the refined geek.

14May/101

Windows 7 Media Center + Extender vs. Mac OS X + AppleTV = not a fair fight.

I am a long-time Apple TV user, stubbornly making Apple's "hobby" useful in my home theater with an array of hacks and community developments -- despite their efforts to keep it locked up. I found that, once hacked, it was the most flexible and elegant thing out there for getting my media from my computer to my TV. With Windows 7, and my unabashed enthusiasm for it, I decided to give Windows Media Center another try. What I discovered puts my hard-hacked Apple TV solution to shame...

OS X + AppleTV

To start with, the Apple TV is a good iTunes Store device. If you're happy consuming only the content Apple offers through their store, and want a way to get it on your TV, its a good solution.
No one gets all their content through iTunes, though, so enter the Patchstick. With it you can unlock Apple TV's OS X potential, allowing SMB or AFS file sharing with your computer, run an app called Sapphire to put a pretty face on your media library, and even install Boxee to get access to a number of additional Internet-delivered content providers.

Hacked, the Apple TV is a very useful device, and as long as you don't mind trailing Apple's updates by a couple weeks to a couple months, using it along-side a Mac and an iPhone/iPod touch its a elegant and cohesive solution -- most of the time. Add an Airport Express or two in some other rooms, and you have a whole-home music and video set-up.

The biggest complaint I had is that the FrontRow experience pales compared to the Apple TV. In our set-up the computer doubled as the bedroom media center, and while it was nice that both the home theater and our bedroom could share the same media, the experience lost cohesiveness at the computer...

On the Mac -- the more powerful device -- we'd frequently be switching between FrontRow, the Finder and iTunes to manage content. I couldn't imagine using a Mac as a home-theater-only device; you constantly need to pick up the keyboard and mouse. The Mac itself was essentially unaware of the AppleTV, save for syncing content. And FrontRow is essentially unaware of the iTunes Store. Its like Apple isn't really sure where an actual computer fits into the scenario.
I used a Rube-Goldberg device of RSS > Google Reader > Google Reader Notifier > Transmission BitTorrent client to get my subscription-delivered content -- a fragile chain that broke not infrequently -- and an AppleScript scheduled via iCal to keep the file system clear of stale content.

Updates on the Apple TV became a management nightmare -- the device is under-powered to begin with, so every couple months it would need a wipe and restore. When that happens, expect to carve out a couple hours to get the hacks back into place. On top of that, the stinking device doesn't have an On/Off switch, so I had to co-ordinate timers and CRON jobs to keep it healthy and prevent it from sucking through my power bill.

Don't get me wrong. Its workable. Its lightyears ahead of what your cable company offers. And it is pretty slick when its all working - no one can accuse Apple of making ugly UIs. It looks good. If you already have a Mac, you can pick up an AppleTV for pretty cheap, and get started at a reasonably low cost. But since you can't do much without hacking, this isn't a solution I'd expect my parents to use.

WMC 7 + XBox Media Center Extender

The reason I've stayed away from Windows Media Center, and its Extenders, in the past, is that I'd constantly hit a brick wall trying to use content not natively supported. It felt cludgy, and its use of what was essentially Remote Desktop Protocol just seemed like a half-hearted attempt.

A lot has changed in Windows 7. It natively supports MP4, and DivX AVIs, so right out of the box it plays almost anything you throw at it -- no hacking needed. Its still pretty much RDP under the hood, but that technology has matured to the point where you don't even notice it any more. In fact, because it ensures a consistent experience between the Extender and the PC, its actually a good thing.

The approach is different than the Apple TV -- the Extender is a function of the computer. While the AppleTV can do things that FrontRow can't do, in the Microsoft scenario, the Extender is somewhat dumb. Turns out, this is fine. I expect my PC to be more powerful than my TV. But there's not a whole lot of compromise. Some of the Extras don't appear on my TV, and a few menu options are left out when shown on the Extender. Otherwise, the experience is the same.

The two most important things about Windows Media Center are that it's consistent across devices, and it's extensible across devices:

  • It's so consistent that I can pause a movie downstairs on the big TV, go upstairs and resume the show where I left off from the bedroom.
  • It's so extensible that I don't have to hack it to add plug-ins, or new functionality -- I just run an installer on my PC, and both it, and my Extender device are instantly upgraded.

A low-end XBox costs less than an Apple TV, is way more powerful and responsive, has an Off switch, and oh ya... it plays great games too. Everything "just works" together: you plug it in, follow a pairing process no more complicated than the Apple TV requires, and within seconds all your content -- regardless of source -- is available. There are dozens of online content providers built right into Windows Media Center, and others can be added on simply by even a novice computer user.

I use a uTorrent on the PC with the RSS functionality built-in for my subscribed content, which shows up in the "Pictures + Videos" section of WMC instantly. And best of all, I put the keyboard and mouse away, because I can do pretty much all common media management tasks on the PC right from my remote.

Not a Fair Fight

Apple really only has their toes in the water here, and Microsoft has been working up to Windows 7 for quite awhile. But while Apple has the iTunes Store and the devices, Microsoft's only real asset in this arena is the XBox. Apple could, if they chose, offer a cohesive PC/TV/Mobile media acquisition and consumption strategy, but I think they're genuinely unsure of where the computer should fit into the picture -- they prefer a locked-down environment, but a full computer gives the user more control than they're comfortable with -- so they've moved timidly into the living room.

Microsoft has chosen a more open path, with any number of Extender devices, (you don't have to buy an XBox -- other devices will do the same job) a broader array of native media types, and extensibility offered to other content providers besides their own store. Windows 7 is really good, and Windows 7 Media Center trumps everything else out there, hands down.

Full Disclosure

Despite being a Microsoft employee, my job has nothing to do with Windows Media Center or XBox. Aside from employee pricing in the company store, there's no perk for me to use the Microsoft offering over anyone elses, and no job expectation that I will do so. I choose freely what technology goes into my home, and I have a very heterogenerous network, with Macs, PCs and other devices playing happily on my WiFi -- check out my tag cloud: I like Apple stuff!

For a long time I stuck with the Apple TV because, once hacked, it was the best solution out there -- regardless of who I work for. That is no longer the case. Windows Media Center 7 with an Extender is a better, more elegant, more flexible and more cohesive solution. Don't believe me? Try it out -- I think you'll see, as I did, that in this round, Windows is the clear winner.

30Dec/091

AppleTV for Mac

This remains the most popular thing I've ever posted -- despite the fact that its really nothing special. The meat of it is a little start-up script that contains no undiscoverable tricks. I don't even use it any more!
Nonetheless, it's in-demand, and I can't find a hosting method that can keep up. So, here's my solution:

  • The start-up movie is no longer available here -- it probably shouldn't have been posted here to begin with. If you find someone with a Patchsticked AppleTV, it's trivial to SCP in and grab the start-up movie (discussed here.)
    You can also use any other movie you want, which you specify when you edit the script.
     
  • The screen saver never worked right on a normal Mac, but Scott Q has engineered a replacement. His link appears to be down, but get in touch with him and send him your thanks.
     
  • The script itself is still available here.
    Copy and Paste the script into the AppleScript editor, updating it to provide the path to where ever you want your start-up video, and save it as a run-only script. Add it as a Login item in your account, and you're set.
     
  • The background image I made is awful (it was just a screen shot) and I'm sure someone's made better, but I'll keep that here if you want it. If you do this right, you should only see the wallpaper for a few seconds anyway, so if you make yourself an all black image, or find a nice Apple logo, you'll be all set.

And honestly, that's all that was released. Like I said, nothing magical. My Mac Mini worked fine as a Home Theater PC, but eventually I just went with an actual hacked AppleTV (which smoothly handles anything but MKV) because I wanted my Mac for other things. If you find any other great ideas, feel free to share them here!

Tagged as: 1 Comment
16Jan/090

Automating an Apple TV with Cron

Copy and enable Cron from 10.4.

Schedule Cron jobs using crontab at the command line. Use Ctrl+D to exit crontab once all your jobs are created.

Examples:

Restart the AppleTV at 8:10am every morning (say, to re-establish network connections with computers that were off during the night):

10 8 * * * sudo /sbin/reboot

Shutdown the AppleTV at 1:00am every morning:

0 1 * * * sudo /sbin/shutdown -h now

You'll need to enable the frontrow account to use sudo without a password.

Tagged as: , , No Comments
7Nov/080

AppleTV Screen Saver – for a regular Mac!

Here's a cool little release for those interested in making a Mac more like an AppleTV.
Scott Q writes:

I've just finished writing my own version of the AppleTV screen saver called QTV. After lots of searching I couldn't find anybody that had a working version that actually did the same stuff the real AppleTV version did. QTV will work on both Tiger and Leopard (10.4 & 10.5) and has a random array of photos that you specify floating vertically across your screen at varying 3D depths and moving at varying speeds while periodically rotating as a group. My version also allows you to optionally have a glimmering sun cast it's glow across the entire scene. You control everything thru various settings including: speed of front, middle and rear photo scrolling, the folder to search for images in, spin to the left or right, cast shadows from front and middle photos, the rotation interval speed, and whether to show the glowing sun or not.

Read more about QTV and download from his website!

Tagged as: , No Comments
11Aug/080

Changing the Startup/ Intro movie on an AppleTV Take 2

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 my AppleTV before I upgrade to Take Two. Then I went hunting for where Apple had stashed its replacement in the Take Two OS Install. 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...

Tagged as: No Comments
22Jul/080

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

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.

Tagged as: , , No Comments
21Jul/084

Using AppleScript and a Shell Script to Restart an AppleTV remotely

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. If you're using an older patchstick, the process is a little different, since it may only support 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 /etc/sudoers > ~/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 (chmod 0440) and ownership (chown 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'

(drop the -1 for newer Patchsticks)

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 &"

(drop the -1 for newer Patchsticks)

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.

10Jul/080

Hacking the AppleTV – Fourth time’s the Charm!

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, use a 10.4.9 install to copy the necessary libraries, per these instructions.
  • 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, then Perian.

Also, I do not recommend using Perian for H.264 decoding. Let the AppleTV built-in stuff do that -- seems to work better for me... and once you switch, there's no easy way to go back.

Now about 2.2 and 2.3...

All of this seems to work on 2.1, 2.2 and 2.3.

Tagged as: No Comments
9Jul/080

Restart TwonkyMedia after scheduled sleep

In our house, a Mac Mini serves at the content library host. It runs iTunes and shares other media files. 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.)

7Jul/080

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

  • 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.
Tagged as: No Comments