Friday 25 September 2009

DVB-T in Denmark with Linux

Recently I acquired a cheap USB DVB-T receiver for the purpose of mucking about with the TV stream here in Denmark. I had little success with it on my laptop running XP, but that is probably because the supplied software is pretty rubbish, and it didn't help that the laptop only supports USB 1.1. My target system is an Athlon 1800XP running OpenSUSE 11.1.

The device (EC168) does not have a native driver available, either in the default kernel or the kernel from the Kernel_HEAD repository, so I had to obtain it from http://linuxtv.org/hg/~anttip/ec168/ and compile it by hand, which was a simple task. I installed the driver and added the prerequisites to /etc/sysconfig/kernel. Upon restarting I was greeted with success:-

[ 11.488833] dvb-usb: downloading firmware from file 'dvb-usb-ec168.fw'
[ 11.565348] dvb-usb: found a 'E3C EC168 DVB-T USB2.0 reference design' in warm state.
[ 11.580194] dvb-usb: will pass the complete MPEG2 transport stream to the software demuxer.
[ 11.736297] DVB: registering new adapter (E3C EC168 DVB-T USB2.0 reference design)
[ 11.923407] DVB: registering adapter 0 frontend 0 (E3C EC100 DVB-T)...
[ 11.980465] ieee1394: Host added: ID:BUS[0-00:1023] GUID[001106664566a90d]
[ 12.202109] MXL5005S: Attached at address 0xc6
[ 12.217079] dvb-usb: E3C EC168 DVB-T USB2.0 reference design successfully initialized and connected.
[ 12.232312] usbcore: registered new interface driver dvb_usb_ec168

The next step is to scan for channels. The opensuse package "dvb" contains large number of frequency files, organized by country.

scan /usr/share/dvb/dvb-t/dk-All > ~/.dvbrc

This is not necessary, but useful to work with some applications and is an easy way to check that things are working. If no channels are found you may need to use a better ariel.
Luckily I live in a place with a very strong signal so the supplied indoor antenna works perfectly. It is worth noting that the frequency file may be out of date. For example, where I live in Aalborg there is a multiplex on 810MHz run by Boxer, and this frequency is not in the file. I suggest consulting the organization responsible for managing allocation of frequencies in your country.

My intention is to stream the multiplex onto IP, and the best software for this is getstream from http://silicon-verl.de/home/flo/projects/streaming/. I also applied this patch to enable streams to be viewed over IPv6. A copy of my configuration can be obtained here. I split each programme into a separate stream, and apply the EPG data (PIDs 0x10, 0x11, 0x12 and 0x14). You can also stream the entire multiplex at once using the special PID 8192.

There is another project for streaming DVB to IP called DVBlast. Unfortunately it does not seem capable of supplying streams over HTTP as well as UDP/RTP.

Another useful tool for checking your streams is TSReader. There is a free "lite" version available, as well as paid options.

Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4

DK Multiplex 1 Stream Information (Before November 2009)
DK Multiplex 2 Stream Information (Before November 2009)

DK Multiplex 1 Stream Information
DK Multiplex 2 Stream Information
DK Multiplex 3 Stream Information
DK Multiplex 4 Stream Information
DK Multiplex 5 Stream Information

Followers