DTV - Twinhan

From Smop.co.uk

Jump to: navigation, search

Contents

DVB/DTV - Digital Video Broadcasting / Digital TV

My notes on how I got DTV working (with a lot of help from Hugo Mills and also from Patrick Boettcher's page.

BTW if you are confused about DVB-S, DVB-C and DVB-T, don't be - it's just a way of describing the media - S=satelite, C=cable, T=terrestial (aka freeview in the UK).

Prep work

Firstly get some nice equipment - I used a Twinhan DTV Alpha which is not much bigger than a cigarette lighter (recommended by Hugo). It cost me £55+VAT from Ambros. You require high speed USB (480Mb/s) since the bandwidth requirements are pretty high.

Then have a look at Wolfbane which will give you a good idea about aerial requirements. Have a look at the distance to the transmitter and its bearing as well as its field strength.

Im very lucky - 7miles away from Hannington with a field strength of 64dBuV/m.

Building stuff

Your next task is to prepare the linux kernel, you will want CONFIG_INPUT_EVDEV for the remote control and CONFIG_FW_LOADER (driver->Generic driver options->Hotplug firmware loading support) at the bare minimum. You will also need USB support (doh!)

I didn't use the mainline kernel for video4linux or DVB support, I used dvb-kernel from http://linuxtv.org/cgi-bin/viewcvs.cgi/

Now follow the instructions in dvb-kernel (really simple) and try loading the modules. I did have a few fail so don't worry too much. I assume everyone uses hotplug or some variant, I then plugged the gizmo in and checked dmesg. It had picked up the device and tried to load firmware which failed (as I expected). I then copied the firmware mentioned - dvb-usb-vp7045-01.fw - into /usr/lib/hotplug/firmware. I then unplugged and replugged the device in and hey presto - dmesg says everything is fine and the Twinhan tuner gets a blue light or two.

Tuning and playback

Firstly you need to check permissions on /dev/dvb/* - on my Debian box they are in the "video" group which I am already a member of. That's good, no need to be root anymore!

Now we need to create a channel list - this has channel names, frequencies and various IDs in it. Create directory call ".tzap" in your home directory, then run (using a suitable seed file):

scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/uk-Hannington | tee ~/.tzap/channels.conf

It can take a few attempts to get a full list - try moving the aerial around and see if that helps. It took me about four attempts.

At this point the dvb-kernel instructions stopped working, however Hugo suggested using dvbstream which worked wonders. Looking at the first line in my channels.conf we see this:

BBC ONE:706000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_3_4:QAM_16:TRANSMI
S
SION_MODE_2K:GUARD_INTERVAL_1_32:HIERARCHY_NONE:600:601:4163

If you followed the dvb-kernel instructions you could try "tzap 'BBC One'" and it would look ok:

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 706000000 Hz
video pid 0x0258, audio pid 0x0259
status 00 | signal 3000 | snr 0000 | ber 00000000 | unc 00000000 | 
status 1f | signal 8222 | snr b2b2 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
...

Three things to note here are the frequency (706000000Hz) and the video and audio pids of 0x258 and 0x259 (in decimal 600, 601). You can actually see these in the channel.conf file (second field and near the end of the line).

For me, mplayer and xine never worked as described in the dvd-kernel readme. Fortunately Hugo came to the rescue and said that I could skip tzap and just use dvbstream:

dvbstream -f 706000 -a 601 -v 600 -o > filename

Note the loss of three of the zeros from the frequency field. This should record a file that xine and mplayer both understand. Finally you can just use a pipe:

dvbstream -f 706000 -a 601 -v 600 -o | mplayer -

Frontend

Currently just written a tiny little helper script I call "tv":

#!/bin/sh

# $Id$

# watch TV

channels=~/.tzap/channels.conf

channel="$1"

awk -F: "BEGIN {IGNORECASE=1}; /^[^:]*$channel/ { print \\$2, \\$11, \\$12, \\$
1}" < $channels | \\
while read freq video audio channel; do
  echo $channel, $freq, $video, $audio;
  mhz=${freq%???}
  echo "dvbstream -f $mhz.${freq#$mhz} -v $video -a $audio -o | mplayer -"
  echo "dvbstream -f $mhz.${freq#$mhz} -v $video -a $audio -o | xine stdin://"
done


Not got this far yet. Nor have I tried the remote control.

Personal tools