Friday, August 17, 2007

Playing Live TV from Satellite box on Linux

This is more of a note to myself, as I'm sure this involves an unusual set of hardware and software.

I have a standard definition DirectTV satellite box on my desk. I wanted to display its content on my Mythdora Linux box—actually, I want to record standard definition programming with MythTV, but I haven't quite gotten there yet. [Update: This post is about recording]. I have a pcHDTV 3000 capture card in my Linux computer with an s-Video input, and a Chaintech AV-710 audio card with a line level input (it's the second one from the right). I figured I could bring the video in through the s-Video port and the audio in through the line level port via an s-Video cable and an RCA to mini-jack cable, it would just take a little configuration tweaking.

First, I had to use alsamixer to turn on capturing, so I brought up the capture display for the AV-710 by using alsamixer -V Capture and selecting the Line capture item and hitting the space bar and then setting the Capture level item to a moderate value. (Actually, I did a ton of stuff trying to make this work, but I think it boiled down to this.)

Then I had to figure out the voodoo to cause mplayer to display the video from the pcHDTV card combined with the audio from the AV-710 card. This ended up being:

mplayer -tv driver=v4l2:device=/dev/video:input=2:outfmt=rgb24:alsa:amode=2:audiorate=48000:forceaudio:immediatemode=0 -vo xv tv:// -vf pp=lb -ao oss:/dev/adsp

Breaking this command line into parts:
  • -tv driver=v4l2:device=/dev/video:input=2 means the Video For Linux framework will grab video from input 2 of the pcHDTV card
  • alsa:amode=2:audiorate=48000:forceaudio:immediatemode=0 means audio will come from the ALSA frameworks default capture device at a sampling rate of 48000 Hz (which is the frequency that my TOSLink output needs)
  • -vo xv tv:// set the video output
  • -vf pp=lb means to use a linear blend deinterlace algorithm
  • -ao oss:/dev/adsp means to output it to what happens to be the optical output of the AV-710