Video stuff

If I get around to it I will put up here the scripts/programs that I use for watching/recording DVB TV on my linux box.

Basically I use:

  • The excellent mplayer for watching video.
  • dvbstream(with a few patches) and buffer to capture the DVB stream.
  • a few scripts I wrote to control those apps.
  • my pgpanel application for showing a control panel with buttons for each of the channels etc.

Here is a screenshot of my TV pgpanel.
screenshot of a panel of buttons


Here is a config file for my TV pgpanel.

To use it you would do something like the following:

  ln -s /opt/pgpanel2/run ~/bin/pgpanel-tvrec
  mkdir ~/.pgpanel-tvrec
  cp ~/download/pgpanel_tvrec_cfg ~/.pgpanel-tvrec/cfg
		
then run:
  ~/bin/pgpanel-tvrec &
		
The buttons are configured to call my dvb-tv script (see below).
I have a few scripts which work together:
Don't waste your time downloading them unless you are willing to hack them a bit to get them to work (changing paths etc).
  • dvb-tv
    This script is basically the front end for mydvb.pl. It accepts command lines of the form:
      dvb-tv abc sd rec
      dvb-tv sbs sd rec
      dvb-tv abc dump rec
      dvb-tv seven hd play
      #in this example, 'abc', 'sbs', and 'seven' are channels and correspond to a transponder
      #                 'sd' and 'hd' correspond to the programs for single-def and hi-def within the current transponder.
    		  
  • mydvb.pl
    This script handles:
    • It loads the channels configuration and converts simple channel specifications (eg abc sd) to the parameters that dvbstream requires.
    • When recording, it couples dvbstream with buffer to write to disk,so that it is not constantly writing to disk, and does not compete for IO with other processes. Instead it does a burst every now and then.
    • hooking up dvbstream and mplayer for watching in real-time (without recording).
  • smydvb.pl
    This script just validates the command line parameters before calling mydvb.pl (since these parts are running as root).
Here is my channels config file channels-adelaide.conf. (If you live in adelaide, you can save it in ~/.mplayer/channels.conf).

sudo configuration

My sudo configuration looks something like this:

myusername    BLAH=(root)     NOPASSWD:       /path/to/sbin/smydvb.pl ?*
myusername    BLAH=(root)     NOPASSWD:       /bin/killall -TERM dvbstream
myusername    BLAH=(root)     NOPASSWD:       /bin/killall -KILL dvbstream
Basically the dvb-tv script uses sudo to execute mydvb.pl when it thinks it is necessary for it to run as root (when it needs to access the DVB devices). Although it is probably easy enough to set up the devices to they can be accessed by a normal user, I run it as root anyway so that if I am recording something it can use the space on disk that is reserved for root.
I also have some patches for dvbstream's channel scanning utility tzap to make it handle the way things are done in Australia a bit better (ie increase some timeouts, ignore some pid values). I'll put them up here sometime soon hopefully.