MythTV: HD

A long while back I found out that mythtv supports capturing video over firewire. The idea is that as long as one has a cable box where the jack is turned on, it will spit out the complete video and audio signal for whatever channel you are currently watching, even if it’s HD.

Although I didn’t think my current mythtv machine (Athlon 1700+) would be fast enough to play back HD, I could still use the firewire connection to change channels instead of my current unreliable IR method. I bought a cheap firewire card, and it worked. So I knew that, one day, I could upgrade the machine and get full HD.

So recently, I dropped 350$ at newegg.com and bought:

GIGABYTE GA-M61P-S3 Socket AM2 NVIDIA GeForce 6100 ATX AMD Motherboard $84.99
AMD Athlon 64 X2 3600+ $69.00
WINTEC AMPO 1GB (2 x 512MB) 240-Pin DDR2 SDRAM DDR2 800 $44.99
Seagate Barracuda 7200.10 500GB $129.99

The upgrade was pretty smooth. Here are the steps.

  1. Back up the old machine onto a firewire drive. (I ran into problems here because newer ubuntu kernels have problem with firewire, and the old VIA chipset has USB issues. Most people would have no trouble here.)
  2. Rip out the guts of the machine, leaving only the case, power supply, and dvdr drive. (and one of the IDE drives which is 160 gigs and worth keeping.)
  3. Install new mobo with CPU, heatsink, and RAM already attached. Connect the drives. (I had to buy a little molex to SATA power cable, but that was cheap. thanks microcenter!)
  4. Also install old firewire card since mobo only has one connector.
  5. Boot up, see if it works! (I ran into a snag here because I didn’t connect a secondary 12V power cable to the motherboard. The manual helped me figure this one out.)
  6. Burn an Ubuntu CD, install. (So easy!)
  7. Use synaptic to install mythtv, xine, mplayer, etc. (So so easy. The mythtv packages are very nicely done)
  8. Set up new LVM for mythtv data, joining the bulk of the old 160 gig drive and the new 500 gig drive.
  9. Restore mythtv database and mythtv data (it takes a long time to copy 240 gigs of data.)
  10. Wrestle with firewire for a long time trying to get a signal. Peruse the mythtv wiki, which contains good solutions.
  11. Get little things working like lircd, mythweb, my xine script, and surround sound. (I haven’t got surround sound yet, it requires purchasing a little SPDIF bracket and a long toslink cable.)

    It took a full, busy day, most of which was spent copying the old data and trying to get firewire to work. Everything else was pretty low-impact, including such previous headaches as installing mythtv and configuring mysql. It’s still way too hard for the average user, but at no point did I feel like I was breaking a sweat. I’ve spent a lot of time with mythtv so I know where a lot of the “unbreakme” buttons are. I know I have to set this up, or tweak that option… things that should be defaults but aren’t. I’d say 90% of the difficult stuff was because I was transferring old data and had permissions issues. If this was a new install, the only blocker would have been the firewire issue.

    All in all, a day well-spent, and now I can record and play back native HDTV streams like they were youtube videos. It’s been a long time since I’ve been able to spread hardware all over the floor.

    Did I mention this cost me 350$? Compare that to the competition.

March Madness — nerd style

My work is doing a silly contest around the whole NCAA thing. Back in high school kids used to run around comparing their brackets and arguing over every detail, and I hated it. I don’t follow basketball at all, and other than knowing that Duke ususally does well I have no basis upon which to make any choices except the seeds.

So I decided to write a bracket-generating algorithm that uses the seeds to generate weights for a random function and pick teams that way. The algorithm works as such:

  • for a pair of teams, take their seeds and invert them (make small numbers big)
  • divide each seed by the total of the two seeds to get values 0 < = x <= 1
  • get a random number 0 < = r <= 1. If team a’s chance is >= that value, they win

The actual code isn’t as nice as that explanation, but it should be mathematically equivalent. Any errors in programming only make these results more my own. I took the results from the first run that (a) worked, and (b) had Wisconsin (my alma mater) not getting knocked out in the first round.

Based on brackets.py, the final four will be: Arizona, Kansas, Texas, and Ohio St.

Kansas will win.

Source code after the break:
Continue reading “March Madness — nerd style”

Game theory and movie piracy

I haven’t seen anyone else linking to this, but the blog Freedom to Tinker is doing a badass academic analysis of the effectiveness of HD-DVD AACS encryption using Game Theory. Rather than simply concluding that the studios are evil and hackers will beat the system, they’ve analyzed the encryption method to determine the optimal behavior for each side.

They come to a fascinating conclusion:

It turns out that the attacker’s best strategy is to withhold any newly discovered compromise until a “release window” of size R has passed since the last time the authority blacklisted a player. [. . .] Once the release window has passed, the attacker will use the compromise aggressively and the authority will then blacklist the compromised player, which essentially starts the game over. The studio collects revenue during the release window, and sometimes beyond the release window when the attacker gets unlucky and takes a long time to find another compromise.

They point out that this resembles the current studio model of release cycles:

Interestingly, this release window strategy resembles the studios’ current approach to extracting revenue from films, in which a film is available first in the highest-revenue format — in theaters — then later in a succession of lower-revenue formats — DVD and television. The idea is to extract more revenue from the most enthusiastic fans in early stages and pick up whatever revenue is available from everyone else later.

There are currently seven long articles about the topic, but they are all worth reading.

Apple’s solution to confusing error messages:

Just don’t show them!

If you try to eject a CD or DVD and the drive is still in use by another program, an operating system can’t eject the disc because that might crash that program. In GNOME, a helpful error message is generated:

Unable to eject media
Details:
umount: /media/dvdrecorder: device is busy
umount: /media/dvdrecorder: device is busy
Error: umount failed
eject: unmount of `/media/dvdrecorder’ failed

This error is a little confusing, because the first line tells you the error, but the reason is buried in the raw log text. It would be nicer if it just said “Unable to eject media, disc is in use by another program.” But that’s still not great, because it doesn’t tell you which program is using the drive.

On Mac OSX, their solution is: just don’t show an error. You can push eject as much as you like, and the big eject icon will appear on the screen, but else nothing happens. Problem solved!

In another case, we have a fibre storage system that has an artificial read-only mode. In other words, a mounted drive appears to be writable but actually isn’t. I’m told on windows if you try to write to that drive you get an error. Probably “Unable to write to this drive.”

On OSX, it lets you write to the drive. But it doesn’t actually work. In fact, you can somehow read the files on that drive to supposedly confirm that they are there. But they are not. The next time you unmount / remount, or reboot, the files are gone. No error message, no indication of any kind that the procedure failed. I’ve also seen this problem with regular AFP network drives, where a file is written to a disconnected share and there’s no indication of a failure.

I can understand hiding weird messages from users, but sometimes an error message would make my life as an administrator a lot easier. We once lost 2 days of work to the “haha you thought you were writing to the drive” error, so this isn’t just an incidental problem.

upgrading to Ubuntu Dapper

I upgraded to Dapper over the weekend. I’m upgrading to an unreleased version of an operating system, so some of these issues may be fixed by the time the final version comes out in June:

  • The versions of ibm_acpi and ipw2200 I use are now installed by default. Excellent
  • Tomboy (my own compilation) as crashing, had to recompile and reinstall.
  • Font hinting got fucked up again. Every single time I upgrade linux I get this problem where the autohinter is not turned on, making my fonts look like ass. I had to install freetype and fontconfig by hand to fix this.
  • screensaver settings reset, had to fix
  • networkmanager didn’t show up correctly, had to tweak /etc/network/interfaces to fix.
  • Included fglrx didn’t work well, needed to install ATI’s own version.

All in all a decent upgrade. I spent most of my time playing around with getting Xgl and compiz to work, which I eventually did.

Update:

Dude, Xgl is totally working.  I’m cubin’ it up like a mofo.

Cheap computers

oooooh. This is a mac mini clone with linux-friendly hardware. If there was decent software to stream music over wireless, it would make a great kitchen PC. Or since it has ethernet and wifi, it’d be a great little home server. There’s always a need for little servers and firewalls, and this looks like a great choice for those uses.