The Caboteria / Tech Web / LaborIntensiveTv (18 Dec 2008, TobyCabot)
Most folks buy their TV's at places like Sears or Best Buy, and there's a lot to be said for plunking your credit card down and driving home with a functional television set. But that's not my style. I've been using a Commodore 64 color monitor hooked up to a VCR since the late 80's and it's worked great. On the other hand, VCR's are going the way of the dodo and a 13" television with weak mono sound isn't much fun so I should probably upgrade.

Given my fondness for doing things the hard way I've decided to hack together a computer-powered television set using parts that I've mostly already got lying around the house.

Bill of materials:

As a proof of concept I think I'll try to get my office computer to work with the TV card. The only problem is that my office computer is a diskless workstation so I've been using pre-built kernels from the LTSP project at http://www.ltsp.org/, and their kernels don't have all of the drivers that I need.

Change of plan: I found a project called MythTV http://www.mythtv.org/ which can run in client-server mode. This will allow me to run the tuner in a server in the basement and the display on a workstation in the den.

I wanted to put the tuner card in my 1U VA Linux server but for some reason the card wasn't seen by the operating system. Maybe the little right-angle riser card was broken? In any case it worked just fine in my Intel 815 mobo which will allow me to get it working but then I'll have to move it to my other server, I guess. That's the price you pay for a 1U form factor.

Building MythTV was somewhat challenging. It has lots of dependencies but they're spelled out on the website. This is one of those times where Debian is a good and bad thing. Good because it's so easy to find and install software, bad because many people expect files to be where Red Hat puts them and Debian often puts them somewhere else.

On the other hand, why build when you can apt-get? http://dijkstra.csh.rit.edu:8088/~mdz/debian/dists/unstable/mythtv/

Here's a command-line recorder: http://www.stack.nl/~brama/vcr/

http://tvtime.sf.net/

Here's a site that has a version of mythtv integrated on a knoppix cdrom: http://mysettopbox.tv/knoppmyth.html

Here's a software PVR aimed for European users (but with some nice design features) http://etv.sourceforge.net/

http://www.videolan.org/ - interesting project with clients and servers for streaming video.

http://freevo.sourceforge.net/ , http://www.freevix.org/ - linux mini-distros for media PC's (i.e. linux-driven tv).

http://slashdot.org/article.pl?sid=04/03/12/2148226 - slashdot article about a pc case that looks like a hi-fi component.

2003-06-20 - Spent a couple of hours fooling around with the setup. Was able to get the capture part working just fine (had to compile i2c as a module, also v4l stuff which is very old in the kernel). I can run xawtv and capture snapshots and they look fine. Display is FUBAR - I've installed X and DRI and it seems to run OK, but it splashes pixels all over the display. Looks almost as if you took the red, green and blue parts of the pixels and put them side by side instead of combining them into a single pixel. Guess I'll need some help.

In the mean time I figured out that the cable no longer provides basic signals (it did when we moved in) so I have to use a powered antenna to play around, which works poorly since I've got all of the gear in the basement. Comcast wants $45/mo for basic cable which seems amazingly expensive to me. I would get a $20 discount on the cable modem but I don't care since my company pays that.

2003-09-05 - I've switched over to RCN and signed up for cable tv and made a little more progress. The display problem above must be an X Windows configuration problem because I can run xawtv on the server but display it on my diskless workstation and the picture is fine (although not the most crisp since it's going over the network). It's pretty cool to see that X can stream TV over the network.

2003-09-13 - Got sound and video working on the server. No real problems - I used the debian kernel, alsa, and bttv packages.

2003-09-14 - Moved the tuner card to "phoenix", my Compaq DL380 server. Now I can use the PIII desktop as a client and (hopefully) run it diskless. I was using the on-board sound on the desktop so I had to use a SoundBlaster Live! card that I had lying around in the server.

2003-09-16 - Turns out sound was more complicated than I thought. Mythtv always records and then plays the recording back; that's how it can do things like pause and rewind "live" tv. So you need to set up the sound card so it is recording the Line input but it must be muted. The biggest hassle was figuring out what the different features of the SoundBlaster Live card were and how they worked.

Here's an amixer dump of the card with a working config:

All of the pictures had strange jagged lines when things moved. It turns out there's an option to "de-interlace" the video on the client side. It crashes on the PII machine but works fine on the PIII.

XVideo and Xinerama don't play nice so it looks as if I can't watch TV on my dual-head machine. That's sort of OK since it doesn't have quite enough CPU either.

2003-09-19 - the wierdest problem so far. Cable channels 2 and channel 14 (WGBH-2 and WGBX-44) didn't have the right audio - they had the BBC instead. I was seriously stumped until I noticed that channel 6 (WFXT-25) was in Spanish. Googling for "Mythtv SAP" did the trick. Turns out there's some really random bttv module option that fixed it:

options bttv audiomux=0x56664e
In debian you add this to /etc/modutils/arch/i386, in other flavors of GNU/Linux I think it's /etc/modules.conf.

See http://www.gossamer-threads.com/archive/MythTV_C2/Users_F11/bttv_driver_&_Aver_Studio_TV_Tuner_P73141/ for more info.

2003-09-23 - It turns out that video files are big. Who knew? I managed to wedge this server last night by filling it up with The Simpsons videos. Probably a good idea to put the recordings on a partition other than /.

Installed Myth Weather which is quite cool but I doubt that I'll use it.

2003-09-30 - Adding DVD support to Mythtv was pretty close to trivial. At some time between a year ago and now, someone packaged mplayer and ogle for Debian, so they're both an apt-get away. During the installation process you'll be prompted with the name of a script that will find and install CSS so you can watch encrypted DVD's. The Mythttv module is called MythDVD. Playing is trivially easy but I haven't quite figured out how to rip yet. That's OK, I don't have enough disk space anyway.

I had to add a link from /dev/cdrom to /dev/dvd and make sure that your user is in the cdrom group, but other than that it just works. Cool!

2003-10-18 - I bought an infrared receiver from ebay for $10, my second ebay purchase. It plugs into the serial port and has a little box with a red window in front. I spent about an hour trying to get it to work before realizing that the serial port on the machine I was using was disabled by the BIOS. Duh!

2003-11-01 - caveat emptor. turns out that the infrared receiver (a Silitek SM-1000) only works with the remote that's supposed to come with it, despite the seller's claim that it works with any remote. I picked up a set with the receiver and remote for $30.

To play DVD's standalone you can mplayer dvd:// -vo xv. The -vo xv part is important, without that it skips a lot.

The infrared setup is pretty hokey; there's one daemon to read the device, then another program (irxevent) to translate from the remote control events to keystrokes. With my remote, the problem is that the joystick in the center is much too sensitive which makes it very hard to move one channel at a time.

2003-12-14 - in order to not fill up my / partition (which is small) I symlinked /var/cache/mythtv and /var/lib/mythtv to directories under /home/mythtv. I couldn't find any other way to tell mythtv where to put the files. UPDATE /var/lib/mythtv (where mythtv records shows) is now a mount point on the IDE disk. For now it's a 30GB drive but one of these days I'll swap it for something bigger.

2004-02-15 - I haven't been fiddling much, but I've been watching a lot. Things seem to work well, and MythTV is getting better all the time. Now I wonder if I want to get a better encoder card, I hear that they're worth it because they produce higher-quality output.

2004-02-21 - while I was monkeying around inside the machine (to add an IDE controller) I rearranged the order of the cards to see if it would make a difference in the picture quality. The DL380 has horizontal PCI slots and I put the tuner in the topmost slot so that its electronic side was facing the top of the case, and its back was facing the other cards. It makes a noticable difference! Most channels aren't affected but channels 2 and 6 were very noisy and, while still somewhat noisy, are improved.

2004-02-24 - I'd like to be able to record shows and archive them onto cd or dvd. http://www.forevermore.net/mythtv/ has a tool that transcodes mythtv's file format into formats that can be burned onto disk. Need to try it out.

2004-02-25 - I tried running nuvexport (see above) and it seemed to work OK, but it takes a long time to run. An hour-long show takes 6 hours to transcode to SVCD-quality mpeg, and ends up as an 850mb file. Transcoding to VCD takes the same time but results in a 644MB file so it looks as if it will fit on a CD. Then vcdimager turns it into something that cdrdao can write onto the disk. Hardly user-friendly.

 $ nuvexport (runs interactively)
 $ vcdimager practice1-vcd.mpg
 $ cdrdao write --device 0,0,0 videocd.cue
Our standalone DVD player doesn't seem to like the CD-R media, but it plays in mplayer just fine.

Here's a hint on how to get nuvexport to use the mythtv commercial cutlist when you export: http://www.gossamer-threads.com/archive/MythTV_C2/Users_F11/Nuvexport_and_cutlist_P101885/

2004-03-14 - the vcd's I made of the Dedham episodes of the Practice worked fine on Linux using MPlayer but on Windows the sound's pitch was shifted way up. I think that's because I was recording at 32kHz and the nuvexport tool didn't transcode to 44.1kHz. Evidently MPlayer can deal with this but whatever crappy windows software came with the warthog couldn't. I first noticed this when I got this message from vcdimager:

++ WARN: audio stream #0 has sampling frequency 32000 Hz (should be 44100 Hz)
I'm not sure what the real fix is, but changing my mythtv recording profiles to record at 44.1kHz seems to work fine so I'll use that frequency from now on.

2004-06-01 - things were humming along fine until one day I noticed that I wasn't getting any TV listing data. Turns out the web site that xmltv was screen-scraping from (http://labs.zap2it.com/) changed their format, but also added a web services interface to get the TV data. So I decided that rather than wait for packages I'd pull the source from CVS and build it. Not a bad process overall. I had been running the same version for a while and this version appears to be more stable than what I had.

2004-06-21 - I upgraded the server from Linux 2.4 to 2.6 and found that I had the same problems with sound that I had before (see 2003-09-19). It seems that the magic kernel parameter has changed for 2.6, see http://mythtv.org/pipermail/mythtv-users/2003-November/020414.html.

options bttv audiomux=0xff44e
2.6 is overall a big improvement over 2.4, live TV "skips" less (almost never now) than it used to.

2005-02-12 - Upgraded to 0.17. Problems with the backend getting killed by the Linux kernel out of memory killer. Seems to use a lot of memory when it's recording (or when I'm watching TV):

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
29777 mythtv    16   0  239m  39m  89m S  0.0  1.0   0:00.14 mythbackend
...and even when it's not recording:
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
29984 mythtv    15   0  150m  14m  24m S  0.0  0.4   0:00.87 mythbackend

2005-02-13 - Upgrading to Linux 2.6.10 (from 2.6.6) seems to fix the out of memory killer. The backend has been running fine for a day now and has successfully recorded a couple of shows.

2005-07-16 - this looks like it has a lot of potentially useful features - http://gizmod.sourceforge.net/

2005-08-10 - noticed that despite making the binaries setuid root, they weren't using real-time priority. Guess I'll run them sudo for the time being.

2005-08-12 - things have been humming along fine lately, but tonight everything was broken. Mythtv couldn't connect to the database, although the mysql command-line client could. Turns out that I needed to install a package called libqt3c102-mt-mysql that must have been uninstalled at some point. Since Debian released Sarge it has been less stable than usual on the unstable branch. Can't complain too much, though, it's still pretty stable considering how bleeding-edge the packages are. In trying to figure out what went wrong I ended up upgrading the the bleeding-edge mythtv, too. I hope it works OK.

2005-11-20 - The laptop that we watch TV on had gone funky - the display works fine but the backlight would switch off after a couple of seconds, which makes it hard to watch. Luckily, my Dad came through with an LCD panel (and a 2nd-hand computer) for my birthday so now I've got the laptop working with the external panel. It's not as easy to do as I thought it would be. The issue is that the Radeon chip in the laptop treats the panel and the external VGA adapter as two independent displays, so you need to do a little X.org configuration hacking to get the primary display on the external panel. The key (for me) was explicitly specifying a wide range for the VGA connector's clocks so that X would allow it to run at 1280x1024. After that, X looked beautiful but mythtv and xine didn't work. Turns out that the "Xv" interface that X uses to display video only works on one display or the other, and it works on the internal panel by default. So you need to use the xvattr tool (http://freshmeat.net/projects/xvattr/) to switch Xv to use the external display, e.g. xvattr -a XV_SWITCHCRT -v 1. I made a file called /etc/X11/Xsession.d/98xvattr so that xvattr gets run when X starts.

2005-12-19 - moved the tuner card and 200GB disk from phoenix to sandcastle, and am in the process of getting everything working again. I didn't take good enough notes last time so I'm having to re-figure-out more than I'd like. So far it's been pretty easy - I needed to enable recording on the line input using amixer sset Line,0 mute cap.

2006-02-05 - sandcastle was a disappointment - I couldn't get it to run reliably. So I moved the 200G drive back to noisy old phoenix and bought a PVR-500 card on ebay. Setting it up was non-trivial, but here's what seemed to work, based on instructions on http://ivtvdriver.org/index.php/Howto:Debian:

2006-02-06 - watching live TV works fine, but recording shows doesn't seem to work. I'll try to fix this by deleting both cards in mythtv-setup and then re-adding the pvr-500. Seems to work now; it's cool to see it recording two shows at the same time and using almost 0 CPU.

2006-04-13 - had to make some changes to warthog's configuration due to the new X windows in Debian. First off, it appears as if the external display is display 0 now, so I don't need to run xvattr anymore.

2006-04-19 - been having problems for a few days with the backend going out to lunch. It's running, and you can use the front end, but it doesn't think that it has any shows to record. Looks like this problem: http://www.gossamer-threads.com/lists/mythtv/users/195340

2006-07-19 - everything's been humming along great for quite some time. The 0.19 branch + PVR-500 is really stable. Now if only there were something worth watching...

2007-01-19 - phoenix, my fancy Compaq server, started having disk controller problems so I shut it down and moved to an old Athlon machine that I was using as a diskless workstation. It's not very powerful but it uses all commodity parts, so it should be easier than the Compaq with its tweaky proprietary hardware. Anyway, there's been progress in packaging the stuff that Debian needs since 2006-02-05 when I set up sandcastle (e.g. http://packages.debian.org/testing/x11/ivtv-source). Here's the scoop:

No joy. backend locks up tight, but behaves differently based on log level or whether you're using strace. Maybe http://www.gossamer-threads.com/lists/mythtv/users/241684 has something to do with it.

Nope, turns out there was an nfslockfile.lock in the mythtv directory that must have been leftover from phoenix. Deleted the file and everything was OK.

2007-06-20 - a co-worker pointed out that zap2it is discontinuing their TV listing service. Bummer. It will be interesting to see if an alternative pops up. http://slashdot.org/article.pl?sid=07/06/20/1920224

2007-12-03 - I signed up with http://www.schedulesdirect.org/ when they first started and the service works great! They even retroactively lowered the price!

2008-01-25 - I've been having a problem similar to this one for a while now - it's peculiar and difficult to pinpoint. Sometimes it happens and sometimes it doesn't.
http://www.mailinglistarchive.com/mythtv-dev@mythtv.org/msg05770.html
http://svn.mythtv.org/trac/ticket/3339
Running xset to slow down the time before the keys start repeating (e.g. xset r rate 2000 8) seems to work around the problem. Strange.

2008-07-13 - RCN switched over to all-digital last week so I cancelled my cable subscription and it looks as if we'll be TV-free for a while until I can figure out an over-the-air solution. Who knows? We might even benefit from a break in the endless assault of mindless programming.

2008-08-12 - Upgraded to Debian Lenny. On the server side things look good - the Debian kernel now has the ivtv drivers built in so I no longer have to do all that module-assistant junk that I used to. On the client things also look good, but Xv switched the default display so even though most stuff was displayed on the external monitor, video was displayed on the laptop's panel (which doesn't have a backlight - see above). The answer was to hack the /etc/X11/Xsession.d/98xvattr script I made back in 2005:

#!/bin/sh 
xvattr -a XV_CRTC -v 1

2008-12-17 - haven't been running mythtv for a while now. The combination of netflix and over-the-air broadcast tv is ok, although commercials are a pain. http://elisa.fluendo.com/ - Elisa is another media center project. Looks as if it doesn't do TV yet, but it looks pretty slick.

Topic attachments
I Attachment Action Size Date Who Comment
Texttxt mythtv-mixer.txt manage 10.2 K 20 Sep 2003 - 23:18 TobyCabot soundblaster live mixer configuration
Edit | Attach | Print version | History: r51 < r50 < r49 < r48 < r47 | Backlinks | Raw View | Raw edit | More topic actions
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding The Caboteria? Send feedback