About two years ago I switched operating systems from Windows XP to Ubuntu Linux on my main desktop PC. One of the things I wanted to do was watch digital free-to-air (FTA) TV using this setup. I have a Twinhan Alpha USB DVB receiver which is recognised by Ubuntu automatically, so it was just a matter of chosing the right software. Initially looked at MeTV, Kaffeine and MythTV. MeTV was probably the least difficult to configure. Kaffeine was OK, albeit with a more cumbersome user interface. MythTV seemed overkill for what I wanted, with an odd user interface, too many dependencies (notably MySQL) and too many features I didn’t need.

I’d long been a user of the Windows port of MPlayer, and after a bit of web searching I discovered that MPlayer in Linux could also play video directly from the DVB receiver, provided you had a channels.conf (valid for your reception area) in your $HOME/.mplayer/ directory. This is mine, for digital TV reception in Melbourne, Australia:

$HOME/.mplayer/channels.conf:

ABC News 24:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2314:2315:560
ABC1:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:650:561
ABC2:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2307:2308:562
ABC1:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:650:563
ABC3:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2311:2312:564
ABC Dig Music:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:0:2317:566
ABC Jazz:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:0:2318:567
7 Digital:177500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:769:770:1328
7 Digital 1:177500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:769:770:1329
7TWO:177500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:801:802:1330
7mate:177500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:817:819:1331
Nine Digital:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:519:720:1072
GO!:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:517:700:1074
GEM:191625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:650:1073
ONE HD:219500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:514:672:1585
TEN Digital:219500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:650:1589
ELEVEN:219500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:516:681:1592
SBS ONE:536625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:161:81:785
SBS TWO:536625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:162:83:786
SBS 3:536625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:161:81:787
SBS 4:536625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:161:81:788
SBS HD:536625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_2_3:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_8:HIERARCHY_NONE:102:103:789
C31:557625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_1_2:QPSK:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:101:102:3585

With some exceptions, the above file was generated from running the following command:

scan /usr/share/dvb/dvb-t/au-Melbourne > $HOME/.mplayer/channels.conf

The exceptions are:

(1) there seems to be a bug in the ‘scan’ command that prevents it from selecting the correct audio channels on the HD channels, eg. the last three numbers for ONE HD are reported as “514:0:1585” rather than “514:672:1585”. For the HD channels (ABC News 24, 7mate, GEM, ONE HD & SBS HD) I had to use an external set-top box to find the middle number for the correct audio channel. It’s possible more recent versions of ‘scan’ may have corrected this.

(2) in Ubuntu Lucid 10.04 the /usr/share/dvb/dvb-t/au-Melbourne file is missing the entry for community television Channel 31 that began broadcasting on digital TV recently. The complete file is:

/usr/share/dvb/dvb-t/au-Melbourne:

# Australia / Melbourne (Mt Dandenong transmitters)
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
# ABC
T 226500000 7MHz 3/4 NONE QAM64 8k 1/16 NONE
# Seven
T 177500000 7MHz 3/4 NONE QAM64 8k 1/16 NONE
# Nine
T 191625000 7MHz 3/4 NONE QAM64 8k 1/16 NONE
# Ten
T 219500000 7MHz 3/4 NONE QAM64 8k 1/16 NONE
# SBS
T 536625000 7MHz 2/3 NONE QAM64 8k 1/8 NONE
# C31
T 557625000 7MHz 3/4 NONE QPSK 8k 1/16 NONE

Now you can test it!

mplayer 'dvb://Nine Digital'

Rather than typing this command each time I have several tcsh aliases configured for each channel:

$HOME/etc/dvb-aliases:

alias mplayer-dvb "mplayer -cache 1024 -framedrop -x 688 -y 384"
alias mplayer-dvb-lq "mplayer -cache 2048 -framedrop -x 688 -y 384 -vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all:threads=2"

alias onehd "mplayer-dvb-lq 'dvb://ONE HD'"
alias 11sd "mplayer-dvb 'dvb://ELEVEN'"
alias tensd "mplayer-dvb 'dvb://TEN Digital'"
alias 10sd tensd

alias ninesd "mplayer-dvb 'dvb://Nine Digital'"
alias 9hd ninehd
alias 9sd ninesd
alias gosd "mplayer-dvb 'dvb://GO!'"
alias gem "mplayer-dvb-lq 'dvb://GEM'"

alias 7sd "mplayer-dvb 'dvb://7 Digital'"
alias 7two "mplayer-dvb 'dvb://7TWO'"
alias 7mate "mplayer-dvb-lq 'dvb://7mate'"

alias abc24 "mplayer-dvb-lq 'dvb://ABC News 24'"
alias abc1 "mplayer-dvb 'dvb://ABC1'"
alias abc2 "mplayer-dvb 'dvb://ABC2'"
alias abc3 "mplayer-dvb 'dvb://ABC3'"

alias sbs1 "mplayer-dvb 'dvb://SBS ONE'"
alias sbs2 "mplayer-dvb 'dvb://SBS TWO'"
alias sbs sbs1
alias sbshd "mplayer-dvb-lq 'dvb://SBS HD'"
alias ch31 "mplayer-dvb 'dvb://C31'"
alias c31 ch31

In $HOME/.tcshrc I have added the following command to load the above aliases automatically whenever I start tcsh:

source $HOME/etc/dvb-aliases

You’ll notice initially that there are ‘mplayer-dvb’ and ‘mplayer-dvb-lq’ aliases called by the aliases further down:

‘mplayer-dvb-lq’ is for viewing HD channels on an older PC. Currently
I’m using a 3.4 GHz IBM ThinkCentre, and mplayer can’t quite keep-up
with decoding full 1080i MPEG2 HD broadcasts in real time. Using the
“-vfm ffmpeg -lavdopts lowres=1:fast:skiploopfilter=all:threads=2”
mplayer switches lowers the resolution so it can be viewed in real
time without excessive CPU overhead. There are occasional visual
artefacts, and obvious degradation in video quality, but the end
result is still quite watchable.

‘mplayer-dvb’ is for viewing SD channels.

In the past where I’ve had poor reception, setting a small (1024 KB) cache (-cache 1024) seemed to prevent mplayer from prematurely dying whenever there was no signal. Note that the larger the cache, the more delayed your programme will be – time-shifted by a few seconds or more. For HD broadcasts I have a 2048 KB cache, due to their higher bitrate. You could experiment with these cache sizes or perhaps leave them out entirely.

The -framedrop option tells mplayer to “skip displaying some frames to maintain A/V sync on slow systems”. Even on fast systems this option may be useful where the CPU is overloaded by other tasks, eg. video encoding.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Anti-Spam Quiz: