ozzmosis.com
Sat, 19 Feb 2011
23:20 - Digital TV in Linux
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:
With some exceptions, the above file was generated from running the following command:
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:
Now you can test it!
Rather than typing this command each time I have several tcsh aliases configured for each channel:
In $HOME/.tcshrc I have added the following command to load the above aliases automatically whenever I start tcsh:
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.
The -x 688 -y 384 options tell mplayer to use a window size of 688x384 when not displaying video in full-screen, rather than the too-large default window size of 1024x576 for SD channels and 1920x1080 for HD channels. I chose 688x384 because it has an aspect ratio of 16:9. In mplayer you can use the 'f' key to toggle viewing between full-screen and windowed.
In a future post I'll explain how I record digital TV using this setup, including a Python program I hacked together for scheduled recording.
category: /tech
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.
The -x 688 -y 384 options tell mplayer to use a window size of 688x384 when not displaying video in full-screen, rather than the too-large default window size of 1024x576 for SD channels and 1920x1080 for HD channels. I chose 688x384 because it has an aspect ratio of 16:9. In mplayer you can use the 'f' key to toggle viewing between full-screen and windowed.
In a future post I'll explain how I record digital TV using this setup, including a Python program I hacked together for scheduled recording.
category: /tech
Fri, 19 Mar 2010
07:25 - iTunes URL Decoder
Back in August 2007 podcast pioneer Dave Slusher
requested a method to take an Apple iTunes Music Store (ITMS)
podcast link and translate it to return the standard XML feed of a
podcast. It didn't take long for me to write a quick and dirty Python
program to do the work, but some time late last year Apple changed the file
formats returned by the ITMS servers which broke my code.
This morning I rewrote it. You can download it from here.
The basic usage is:
For example, the ITMS podcast link to the series of Triple M Get This podcasts is:
To run itunes-url-decoder.py you will need Python 2.6 (or newer) installed, or a version of Python that provides the plistlib library.
category: /tech
This morning I rewrote it. You can download it from here.
The basic usage is:
./itunes-url-decoder.py urlWhere url is the ITMS podcast link.
For example, the ITMS podcast link to the series of Triple M Get This podcasts is:
./itunes-url-decoder.py "http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=330582773"As of writing, this returns the following feed URL:
http://www.getthis.net.au/getthis.xmlYou can then paste that URL in any podcatching software - no need to use iTunes!
To run itunes-url-decoder.py you will need Python 2.6 (or newer) installed, or a version of Python that provides the plistlib library.
category: /tech
Sat, 18 Apr 2009
12:58 - Under reconstruction
The ozzmosis.com web site is currently being reconstructed as a blog, with
a new layout. Some content may be missing temporarily, but I'm hoping
not to break too many of the old links in the long term.
Also in the long term, I'm hoping to write a lot more!
The old site is temporarily at http://old.ozzmosis.com/
Update: Phew, done. All the old stuff should be integrated into the new format now. Will leave the old site running for a little while though in case I've forgotten something...
category: /tech
Also in the long term, I'm hoping to write a lot more!
The old site is temporarily at http://old.ozzmosis.com/
Update: Phew, done. All the old stuff should be integrated into the new format now. Will leave the old site running for a little while though in case I've forgotten something...
category: /tech
Fri, 31 Oct 2008
00:00 - How to cleanly stop Explorer in Windows XP
"In Windows XP, you can get Explorer to exit cleanly by getting to the
shutdown dialog (e.g., Start / Turn Off Computer, or Start/Shutdown),
then hold down the Ctrl+Alt+Shift keys and click the
"Cancel" button."
- http://blogs.msdn.com/aaron_margosis/archive/2007/07/17/how-to-cleanly-stop-explorer-exe-on-windows-vista.aspx
category: /tech
- http://blogs.msdn.com/aaron_margosis/archive/2007/07/17/how-to-cleanly-stop-explorer-exe-on-windows-vista.aspx
category: /tech
Thu, 17 May 2007
12:00 - Site facelift
Today the site underwent a long overdue facelift, and I'm no longer
using AsciiDoc for page generation. I'll continue to work on updating
some of the pages as time permits, as some of the information (eg.
Useful software) is now terribly out of date.
category: /tech
category: /tech
