Apr 13 2006

ATI Radeon 7000 VE TV Out

Once upon a time, I was a cheapskate without a 3D-accelerated video card. I
couldn’t play BZFlag, Scorched Earth, or Flightgear. I was deprived. Then one
day I broke down and bought a 3D-accelerated card. I got a Radeon 7000 VE which
was anything but top of the line, but it has perfectly sufficed my needs. It
also has TV out, a fact I don’t remember knowing until a couple of months ago
when I was crawling around behind my desk.

We don’t watch TV. We don’t have dish or cable, and the reception is almost as
bad as the programming. But we do like to watch a few choice shows, e.g. Good
Eats, Smallville, Doctor Who (old and new), and whatever other interesting
things turn up online, like the Pancake
Mountain
theme
or _why’s
FOSCON and other conference videos.
We also like to get movies from the library or Blockbuster, but that’s beside
the point.

So when we got our tax money we had enough cash to throw at an adapter
cable
(although
we spent half as much as that listed price). I had done a little research that
indicated it was possible but hairy to get TV out working with this card. I
enjoy a good challenge, so I ordered the cable.

The cable came yesterday. I got everything working peachily last night. I’m
good at wrangling Linux, but I think that it’s safe to say this card is not
hard to get going. It will be even easier if you found this post.

First things first. Plug in the cable so you’re hooked up to the TV and restart
your computer. You should see the console (boot screen, grub, etc.) on the TV.
That will give you a jolt of excitement; capture it in a cup for later.

Now, when you’ve booted, switch to virtual console 1 (i.e. get out of X) and run:

mplayer -vo vesa:vidix /av/video/pancakemountain.mov

You should see a guy in a cape on both your PC screen and your TV screen. So
you see, it works great. Now, when the movie ends, or you quit, you’ll have a
blank screen and not be able to see what you type. Or maybe you will be able
to. In any case, if you can’t see, just switch virtual consoles, the you can
switch back.

Now, even I spend most of my time in X, so we want to get it working from X. X
runs at a higher resolution and probably different refresh rates than your TV,
so what you see on the TV will be just junk. No big deal, until you want to
watch something. I tried xrandr -s 640x480 and got nothing but a messed up
gnome toolbar to show for it, so let’s steer clear of switching resolution in
X. I tried to figure out how to get mplayer to switch video modes with -vo
xvidix
, but without luck. So I tried -vo vesa:vidix again and it didn’t work
so well. Well, it did work, although the brightness was sky-high. What didn’t
work so well was getting back to X. After running mplayer -vo vesa:vidix ...
from X my USB keyboard stopped working, and I was stuck in limbo. Luckily you
can ssh in and do sudo chvt 8 to get back to normal, as I found after a few
frustrating reboots.

To make a long story less long, I ended up writing a script to do the following

#!/bin/sh
opts="-vo vesa:vidix -ao alsa:device=hw=0.1"
sudo chvt 1
mplayer $opts "$@"
sudo chvt 8

That works excellent. The -ao bit is to use alsa device hw:0,1 which is my
rear output, where the audio part of the adapter cable is plugged in. If you’ve got sudo configured to ask you for your password, you might prefer to jump through lots of fun hoops as explained in the Linux Quake HOWTO.

The only other thing I could hope for is to somehow watch something with
mplayer on the TV, and still be able to use the computer for other things. I
don’t have much hope (without getting another video card, anyway) but if you
know how let me know.

Update

The above solution has a problem: I can’t control mplayer with the keyboard. I can control mplayer from my laptop when I start it over ssh, which is why I didn’t notice that before, but it’s nice to be able to run it from the desktop too.

This is a much nicer script:

#!/bin/sh
opts="-vo vesa:vidix -ao alsa:device=hw=0.1"
sudo openvt -sw -- mplayer $opts "$@"

If you don’t like the idea of running mplayer as root (it’s probably suid anyway), you’re going to have a fun time figuring out how to get "$@" inside of another set of quotes for the su -c command. If you figure that one out I want to hear about it!