Making an AppleTV into a MythTV Frontend

Monday, January 5, 2009

The AppleTV makes an excellent MythTV frontend that can play 1080i HDTV. Buying a used one on Ebay is probably the cheapest way to get a HD capable frontend for MythTV.

I was curious about the stock AppleTV software, so I tried it for a few days but found it too restrictive. The picture browsing was only usable for a small number of pictures and the video player could only play a few video formats. The YouTube and Flickr features seemed nice but were not essential features to me. If you like the iTunes store then you might want to keep using the AppleTV software as that's what it was designed for.

But this is about MythTV and it's time to move on to the good stuff.
As this is a followup to my earlier MythTV post you'd already need the MythTV backend setup.

What you need:
  1. an AppleTV
  2. a USB flash drive 1GB or larger
  3. a USB hub, keyboard, and mouse
  4. a programmable universal remote control
    (my Harmony 550 from Newegg is great)
These are the steps:
  1. Connect the AppleTV to your TV/projector with the HDMI cable and whatever audio cables you want to connect.
    I got my cables from MonoPrice (they have HDMI to DVI cables if you need one)

  2. Create a bootable USB flash disk

  3. Backup the AppleTV software

  4. Reformat the internal drive for Linux

  5. Install MythBuntu 8.10 (I have upgraded to 9.04 without any problems)
    you'll need the keyboard and mouse for this
    choose the latest Nvida driver (I used version 177)
    enable VNC during the installation so you won't need the keyboard and mouse later

  6. After installation remember to do the "Post Boot Fixes"
    The ones for "Mythbuntu Hardy" also work for 8.10 (Intrepid)

    In the /usr/sbin/nvidia_hang_fix.sh file I had to use 200,720 for GPU2DClockFreqs instead of the recommended 200,800 (the 177 driver won't allow overclocking above 720).
    This fixes 1080i playback stability (no more green distortion and freezing).

  7. Setup the remote control (follow the instructions from this link)
    These are most of the files and commands you'll need to use.
    /etc/lirc/hardware.conf
    sudo /etc/init.d/lirc stop
    sudo irrecord -H macmini -d /dev/usb/hiddev0 /etc/lirc/lircd-new
    /etc/lirc/lircd.conf
    ~/.lirc/mythtv
    ~/.lirc/mplayer
    irw /dev/lircd
    sudo /etc/init.d/lirc start

    The Apple remote has only 6 buttons, so have your programmable remote "learn" those 6 and then hold the menu and play button for 5 seconds and then the Apple remote will have 6 new codes for your programmable remote to learn.

    If the remote repeats buttons too quickly increase the repeat value in ~/.lirc/mythtv (mine is set to 5 and and the delay is 0)

  8. Edit /etc/X11/xorg.conf and remove all the extra screen resolutions
    (my projector is 1280x720 so I left that one and removed the rest)

  9. Autostart irexec
    Applications -> Settings -> Settings Manager -> Autostarted Apps
    add command "irexec -d"

  10. The AppleTV CPU is not very powerful so you'll want to disable CPU intensive MythTV theme options
    • Setup -> Appearance
      "Use Transparent Boxes" unchecked
      "Popup Background Shading Method" None
    • Setup -> TV Settings -> Program Guide
      "Guide Shading Method" Eco
    • Setup -> TV Settings -> Playback
      "Current Video Playback Profile" CPU--
      "Display thumbnail preview images of recordings" unchecked
      "Display live preview of recordings" unchecked

  11. I setup a rsync cron job to sync my pictures to the AppleTV hard drive
    rsync -rl --delete --size-only --stats -h -e 'ssh -c blowfish' ~/photos/ appletv:/var/lib/mythtv/pictures/

  12. I keep all my video files on my backend with the big hard drive and use NFS to mount them on the AppleTV.
    edit /etc/exports on the backend to share the NFS directory
    edit /etc/fstab on the frontend to automatically mount the NFS shared directory

One caveat is that the TV/projector needs to be turned on when the AppleTV is booted or Xorg won't detect/enable the display and won't startup. If you know how to solve this please let me know.
UPDATE: This is resolved thanks to Will's comments. The forum with the solution is here http://ubuntuforums.org/showthread.php?t=913224, and the concise version is:
  • run xvidtune -show
    edit the /etc/X11/xorg.conf file
    add the output from xvidtune to the "Monitor" section as a "modeline"
    add Option "ExactModeTimingsDVI" "True" to the "Screen" section
    add Option "ConnectedMonitor" "DFP" to the "Screen" section

References: