Showing posts with label tv. Show all posts
Showing posts with label tv. Show all posts

Friday, November 20, 2009

Watch TV with the ATI TV Wonder 600 USB stick

The ATI TV Wonder 600 USB stick supports NTSC and ATSC, as well as composite input and S-video. It shows up (if you do a lsusb) with a manufacturer:device combo as 0438:b002 from Advanced Micro Devices (AMD), the company that bought ATI a while back .This guide will walk you through the steps of watching and recording ATSC TV.

1. Add the Packman repositories. You can do this in Yast2, under Software, then Software Repositories.

2. Install the dvb, vlc, and MPlayer packages. As root:

yast -i dvb vlc mplayer


3. Get the firmware file xc3028L-v36.fw from here:

http://steventoth.net/linux/hvr1400/xc3028L-v36.fw

and save it to /lib/firmware (you'll need to be root).

4. Get a channel list. Not as root, perform:

scan /usr/share/dvb/atsc/us-NTSC-center-frequencies-8VSB -o zap -a 0 | tee ~/channels.conf


If you're not in the US, then you'll need a different scanning file other than us-NTSC-center. Look at the list in /usr/share/dvb/atsc and select one that is appropriate for your location.

The "-a 0" switch indicates that it should use the first DVB adapter in your system. If you this is a second adapter, then use "-a 1".

This will take some time and will generate a number of "tuning failed!!!" messages. These are harmless.

When the process is complete, you may want to manually edit the first column of the file, which is the name of the station. Some stations include contact information and that may confuse other programs that try and use the file. For example, if the file contains a line like:

WHSD - 1-800-123-WHSD:562000000:8VSB:81:92:3


Replace it with something more readable, like:

NBC:562000000:8VSB:81:92:3



5. Watch TV

vlc ~/channels.conf


If this is the second adapter, use the switch "--dvb-adapter=0". The navigation controls in vlc change the channels.

If you right-click on the image, there is a de-interlacing option. Enable de-interlacing to improve the video quality on LCD monitors, otherwise motion will appear to "tear".

I am able to watch TV on my 900MHz Celeron netbook. It is important to note that different channels will broadcast at different quality levels. Depending on the channel, my cpu usage can be anywhere from 40% to near 100%.


6. Record TV First, copy the channels file to ~/.mplayer/. Record with:

mencoder dvb://"NBC" -o Chuck.avi -oac copy -ovc copy


If this is a second adapter, then it will be 'dvb://2@"NBC"'. This requires very low CPU usage, but an extreme amount of hard disk space (roughly 1GB every ten minutes). You can try to re-encode the file on the fly, but the CPU usage will be very high and I haven't found a combination of settings that maintains the original quality of the video. But as a starting point:

mencoder dvb://"NBC" -o Chuck.avi -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1500:vhq


You can play back the recorded file using any media player, but with mplayer, it's:

mplayer Chuck.avi -vf pp=fd


Where the "-vf pp=fd" switch turns on de-interlacing.

Friday, June 12, 2009

TV Antenna Design

I want to mount my TV tuner inside my laptop and I also want to build an internal antenna. In my area, TV stations are in the frequency range from 500MHz to 750MHz (as determined from my channels.conf file) which according to this online calculator puts my ideal antenna length (for a dipole antenna) at between 90 and 150 mm per half.

I wanted to get a better feel for the best antenna length to use, so I rigged an antenna like this:



and I scanned for channels several times, each time cutting 4 mm off of the end of each lead. I recorded the number of channels detected with each setup and then made a plot of the results:



While 128 mm was the best length, there is quite a bit of noise in the plot, so its hard to say for certain that the best length might not be somewhat shorter or longer. There definitely is a tendency for the longer antennas to do better than the shorter ones. Based off of this, I'll probably end up going for a 130 mm antenna, if I can make it fit in the case.

Also interesting: The 128 mm antenna picked up 34 stations, while the high quality antenna that came with the tuner picked up 37 channels. Overall, I think that is pretty good for an antenna made out of a couple spare pieces of wire.

Tuesday, May 26, 2009

Sabrent TV-DGUSB

Woot recently sold the Sabrent TV-DGUSB USB HDTV (ATSC) Tuner for $30. This card/dongle has horrible support. A Google for it turns up almost no pages and I couldn't even find it on Sabrent's own website. Here's the information I do have on it:

Product: Sabrent TV-DGUSB
ID: 05e1:0480
lsusb says: Syntek Semiconductor
Chips: Auvitek au0828
Chips: Auvitek au8524

A similar card with id 05e1:0400 is supported with code from LinuxTV.org. The cards differ in that this one has the au8524 and the driver supported one has a au8522. It turns out that the difference is minimal enough that we can use the driver from one for the other.

Steps to get it working in openSUSE 11.1:

1. Add the Packman repositories.
2. Get the kernel-source, dvb, and vlc packages.
3. Get http://linuxtv.org/hg/~mkrufky/teledongle/archive/tip.tar.bz2.
4. Unbzip it.
5. Change line 222 of linux/drivers/media/video/au0828/au0828-cards.c from 0x0400 to 0x0480. Build it with "make" and "make install" as root.
6. Reboot (yes, its necessary).
7. Plug in the card. You can verify everything is working by making sure the blue light on the unit is on, the au0828 module is installed ("lsmod | grep au0828"), or "dmesg | tail" should read:


usb 2-6: new high speed USB device using ehci_hcd and address 9
usb 2-6: configuration #1 chosen from 1 choice
Manufacturer ID= 0xff, Chip ID = ffff. It is not a TEA5761
tuner' 9-0042: chip found @ 0x84 (au0828)
tda9887 9-0042: creating new instance
tda9887 9-0042: tda988[5/6/7] found
tuner' 9-0043: chip found @ 0x86 (au0828)
tda9887 9-0043: creating new instance
tda9887 9-0043: tda988[5/6/7] found
tuner' 9-004a: chip found @ 0x94 (au0828)
tda9887 9-004a: creating new instance
tda9887 9-004a: tda988[5/6/7] found
tuner' 9-004b: chip found @ 0x96 (au0828)
tda9887 9-004b: creating new instance
tda9887 9-004b: tda988[5/6/7] found
Chip ID is not zero. It is not a TEA5767
tuner' 9-0060: chip found @ 0xc0 (au0828)
tuner' 9-0061: chip found @ 0xc2 (au0828)
tuner' 9-0062: chip found @ 0xc4 (au0828)
tuner' 9-0063: chip found @ 0xc6 (au0828)
tuner' 9-0064: chip found @ 0xc8 (au0828)
tuner' 9-0065: chip found @ 0xca (au0828)
tuner' 9-0066: chip found @ 0xcc (au0828)
tuner' 9-0067: chip found @ 0xce (au0828)
tuner' 9-0068: chip found @ 0xd0 (au0828)
tuner' 9-0069: chip found @ 0xd2 (au0828)
tuner' 9-006a: chip found @ 0xd4 (au0828)
tuner' 9-006b: chip found @ 0xd6 (au0828)
tuner' 9-006c: chip found @ 0xd8 (au0828)
tuner' 9-006d: chip found @ 0xda (au0828)
tuner' 9-006e: chip found @ 0xdc (au0828)
tuner' 9-006f: chip found @ 0xde (au0828)
au0828: i2c bus registered
tda18271 9-0060: creating new instance
TDA18271HD/C2 detected @ 9-0060
DVB: registering new adapter (au0828)
DVB: registering adapter 1 frontend 0 (Auvitek AU8522 QAM/8VSB Frontend)...
Registered device AU0828 [Syntek Teledongle [EXPERIMENTAL]]
usb 2-6: New USB device found, idVendor=05e1, idProduct=0480
usb 2-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-6: Product: USB 2.0 Video Capture Controller
usb 2-6: Manufacturer: Syntek Semiconductor

8. You'll need a list of valid channels to use. In the USA, use (not as root):

scan /usr/share/dvb/atsc/us-NTSC-center-frequencies-8VSB -o zap -a 0 | tee ~/channels.conf

You will get a lot of messages about "tuning failed". Ignore these. It just means that there is no station on that channel. If you have multiple TV tuners in your system (I did), then you'll need to tell the scan command which one to use using the "-a" switch. 0 is the first tuner, 1 is the second and so on.

When this is done, channels.conf should have a few (or many) lines, each one corresponding to a local TV channel.

9. Start VLC:

vlc --color --ttl 12 --dvb-adapter=0 channels.conf

Again, if you have multiple adapters, tell vlc which one to use with the "dvb-adapter" switch. The next and previous buttons change the channels.



If all went well, then you're watching live high definition TV. If the video is blocky or cutting out then either your processor is too slow (more on this in a moment) or your signal is not sufficient. The antenna that comes with the tuner is pretty small. I found that sometimes putting the antenna on its side improves the reception significantly.

On my 2.2GHz 4-year-old processor, watching the broadcast full screen took 25% of the processor time (using top). This is pretty good and better than BlazeVideo (the Windows software that comes with the card) that took closer to 50%. This means HDTV should be doable on just about every recent computer, maybe even netbooks. I'll try that next and report back.

I should note that some channels use more processing power than others. On my laptop (a five-year-old Sempron at 1.8GHz), the processor usage per channel is constant, but from channel to channel to varies from 15% to 80%.

Here are some websites that I found helpful. The device pictured in the first link is the previous chip version of this one, the au8522:

http://www.linuxtv.org/wiki/index.php/Sabrent_TV-USBHD
http://linuxtv.org/hg/~mkrufky/teledongle
http://forum.videolan.org/viewtopic.php?f=13&t=38890
http://forums.opensuse.org/applications/multimedia/405117-sabrent-digital-hdtv-atsc-analog-usb.html
http://linuxtv.org/wiki/index.php/ATSC_USB_Devices