In April 2009 I set up a new HTPC as a DVR and media center, connected to a new TV and an HDHomeRun. This update is as of November 2009.
Mac Mini HDVR
Signal Source: HDHomeRun
For signal, I bought a DB-4 antenna from Antennas Direct, and an HDHomeRun to connect to it. I installed the antenna in my attic, and since my house is already wired with Cat5E just dropped the antenna wire through the wall next to the ethernet jack, where I could put the HDHomeRun. Once I had it on the network, I tested it with the HDHomeRun-config-gui.app
that they supply.
Computer Hardware: Mac Mini and Upgrades
I started with a base model 2009 Mac Mini (1GB/80GB) with a bluetooth keyboard and mouse. I bought a 320GB 7200 RPM drive (Seagate ST9320421AS) that has good reviews, plus a 2GB DDR3 RAM stick from Crucial.
I followed online instructions for opening up the Mini for the install. They were mostly good, but missed out on telling you about a few things
-
A high-quality (sharp-edged) plastic spatula can crack open the outer case while leaving absolutely no marks. Doing this is time-consuming and difficult−but possible.
- Once you have the outer case off, the tape off, and the antennas unmounted, it is very easy to accidentally unplug the bluetooth antenna cable when lifting the drive frame up off the motherboard. The antenna wire is easily reconnected but takes a surprising amount of force to get the connector back on that little coax mount.
- When you replace the old HD you will have to unstick the temperature sensor and a couple of sound dampers. There's enough glue on them that they'll stick right back on to the new drive. **Remember where (on the old drive) these items were so that you can replace them on the new drive!
- You can test run your mini with the outer case still off. That way you can tell if anything is loose or disconnected before risking having to crack it again.
Computer Configuration
Once the new hard drive was installed, I hooked up a monitor and booted the system from the install disks (this is slightly easier using a USB rather than bluetooth keyboard and mouse by the way).
First, I went to the system diagnostics (About This Mac...) to check that the RAM had been found.
Then I started Disk Utility, and partitioned the drive into 80GB for the OS and 220GB for PVR recordings and other big files. The point of partitioning is twofold:
- Make sure I can never hose the system by having recordings eat all available space
- Keep stuff that requires no backups all in one place.
Though I have a NAS (ReadyNAS NV+) I did not want to use it to store recordings, since its throughput is unlikely to match the local 7200RPM drive.
Software Setup
Once the drive was partitioned, I put the original drive in a USB enclosure, and used Disk Utility to restore from the old drive onto the 80GB partition. Doing this is much faster than making and restoring from a Time Machine backup. I could then boot the machine, and run Software Update to get everything up to date. Then I told iTunes where to find music on my NAS, and copied some favorite photos into iPhoto.
Power Management
I configured the computer to never sleep, and never sleep the display or hard drive either. I also set it up to restart after a power failure.
DVR Software: MythTV
Backend
Next, it was time to install the MythTV backend. Though MythTV started as a Linux project, it does work on OSX. The main resource for this is the wiki page. Since I have XCode on this machine, I went ahead and checked out the latest subversion repository, from which you can run osx-packager.pl
to make a fresh build. Alternatively, using the pointers on that page, you can download a compiled copy build from TheSniderpad.com. I unpacked the Myth* executables into my Applications
folder.
MythTV Prerequisite: MySQL
I downloaded the OSX package for MySQL 5.0.77 and then
I installed MySQL. It comes with a Preference Pane to turn it off and on, and can be set to automatically start up, which is what you want.
Partitioning and Files
On the Recordings
partition, I created a folder named MythTV
, with subfolders entitled Banners
, DBBackups
, Fanart
, LiveTV
, Screenshots
, Videos
, Coverart
, Default
, General
, Scheduled
, and Trailers
. I also created an account at SchedulesDirect to get TV listings. I created directory for mythtv logfiles, as /var/log/myth
and I changed ownership of this directory to the GUI user rather than root so that Myth could write to it.
To set up the backend, I launched Terminal.app
and ran the database commands from the wiki page. First I chose a password (mythtv is a good choice if you are not worried about security). Then I ran MythTV-Setup.app
.
A quick note on running the Myth* apps: when you are first starting out, it is best to run these from the command line (in Terminal.app
) rather than by double-clicking the icons. That way, you can see any useful error messages that would otherwise just disappear from sight. The way to do this is to start a new Terminal window, then run, for example,
/Applications/MythBackend/MythTV-Setup.app/Contents/MacOS/MythTV-Setup
I ran through the setup application, telling it what my database password was and that I have an HDHomeRun (no need to specify the IP unless you have more than one unit). For each of the HDHomeRun's 2 tuners, I had to tell the setup program about my SchedulesDirect account. I also had to let it scan for channels, but that was necessary to do on only one tuner.
I told setup to go ahead and mark commercials during recording, and to keep CPU usage low (which prevents jumpy playback). I also told it which directories to put files in (the ones on the Recordings partition), and that mythfilldatabase
should log to a file in /var/log/myth
.
Once setup was done, I could run mythfilldatabase
(which I again elected to do from the command line) and then start the backend.
Frontend
Now I could set up the frontend. I started the front end and told it the database password in the setup menu, and that I wanted it to automatically skip commercials. I tested LiveTV and recordings. I did not bother to set up any of the other features or plugins since I planned to get all that from Plex.
Automatic Startup
After I was happy with MythTV's workings (and it actually took a few iterations -- you're getting the cleaned up version here), I made a launchd
configuration file to automatically start MythBackend
on login, or at any time the backend crashes. You only want to do this after everything is really truly working because otherwise launchd
may eat half your CPU just restarting MythBackend
over and over, and you have to call launchctl unload -w
to stop that behavior without a reboot. To enforce autostartup, I put a file named org.boonstra.chicago.dvr.MythBackend.plist
in /Users/dvr/Library/LaunchAgents/
, with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.boonstra.chicago.dvr.MythBackend</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/MythBackend/MythBackend.app/Contents/MacOS/MythBackend</string>
<string>-l</string>
<string>/var/log/myth/MythBackend</string>
</array>
</dict>
</plist>
|
I also created a launchd
directive to run mythfilldatabase
periodically, as org.boonstra.chicago.dvr.mythfilldatabase.plist
in /Users/dvr/Library/LaunchAgents/
:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Disabled</key>
<false/>
<key>Label</key>
<string>org.boonstra.chicago.dvr.mythfilldatabase</string>
<key>ProgramArguments</key>
<array>
<string>/Applications/MythBackend/MythFillDatabase.app/Contents/MacOS/MythFillDatabase</string>
</array>
<key>StandardErrorPath</key>
<string>/var/log/myth/mythfilldatabase.log</string>
<key>StandardOutPath</key>
<string>/var/log/myth/mythfilldatabase.log</string>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>1</integer>
<key>Minute</key>
<integer>10</integer>
</dict>
</dict>
</plist>
|
MythWeb
MythWeb is a convenient way to set up recordings, or view status and existing recordings, from any computer in your house.
Setting it up took a few tricks, mostly of editing /etc/apache2/httpd.conf
to enable PHP, and /etc/php.ini
to fix socket communications. I edited the MythWeb configuration file mythweb.conf.apache
to take advantage of the Mac's webserver capabilities, and set directory locations, security and aliases. You can find my copy of this configuration file here. I used htdigest
to create the necessary password file which I saved along with mythweb.conf
into /etc/apache2/other/
, and I saved all the MythWeb code in /Library/WebServer/
, changing ownership to the www user. I logged all these feats on the MythTV Wiki for others to follow.
Plex
Now I could do the easy part -- set up Plex. I downloaded the latest version, installed it, and set up MythFrontend as an available external app. I also told it where to find movies, photos and home videos on my NAS and installed a couple of plugins. I cannot say enough about how awesome Plex is, so I'll let you discover it for yourself. I set up the user account so that it would automatically start Plex at login. Then I unplugged the Mini and brought it to my AV system, plugging it into a 100MB/sec segment of my network.
Final Connections
Using a mini-DVI to HDMI adapter I bought at Monoprice, I connected my Samsung PN-63B550 plasma display using HDMI input #2, and used a TOSLink optical cable to connect from the dual-use output jack of the Mini to an optical input of my Onkyo DS-777 AV receiver. Booting the Mini got me a nice display on the plasma right away. The Mac autodetected the plasma and set its video appropriately, choosing to overscan by default. The overscan is a little too much and hides the top menubar but I don't mind since I'm usually using Plex or Myth. You can turn off overscan in System Preferences->Display. Does anyone know if this Samsung has a "Just scan" option?
Monitoring
The best way to monitor the MythTV backend is by using Console.app
. It's provided by Apple, and is lightweight with a nice interface. Just point it at the appropriate files in /var/log/myth
.
Results
Both sound and video are smooth and good-looking to my untrained ear and eye. When MythBackend is recording two shows and marking commercials, CPU usage is about 100-125% and MythFrontend playback gets slightly jumpy in 1080i (720p is acceptable).
Plex's slideshows are nice (they launch as a screensaver), along with its ability to play iTunes playlists with the visualizer. I'm thrilled with the Myth ability to autoskip commercials.
As a computer monitor the Samsung is acceptable for short periods but it would give you eyestrain to try to use it for a whole day.
To Do:
- Remote Buddy (maybe using a Wii controller?)
- Try to set up commercial flagging on the Mac Pro without making it have to stay on all the time
Problems:
- Apparently it would be good thing to have AC3 passthrough of the sound from recorded shows. However there is apparently still a bug preventing that.
- I cannot find the Myth uPnP server from within Plex.
This revision: November 22, 2009
Contact: htpc(at)boonstra.org
++++++++++[>+++++++>++++++++++>+++++++++++>+++>+<<<<<-]>----.>>++++.<+++++.--------.>----.>++.<<<.>>+..-.+++++.+.--.<.>>>.