czap, szap, tzap
The three programs czap, szap and tzap perform tuning operations (frequently referred to as zapping, thus the name) for DVB-C, DVB-S and DVB-T respectively. They require a configuration file created by scan (or dvbscan). See the scan documentation for details.
The following examples show the use of tzap; somebody with access to DVB-C or DVB-S should check whether they work with those media or not; I'm assuming they do.
Currently, tzap does not have any documentation. About the only thing that you can do is to run it without any parameters. tzap then displays usage information that is almost enough for experts:
tzap [options] <channel_name> zap to channel channel_name (case insensitive) -a number : use given adapter (default 0) -f number : use given frontend (default 0) -d number : use given demux (default 0) -c file : read channels list from 'file' -x : exit after tuning -r : set up /dev/dvb/adapterX/dvr0 for TS recording -s : only print summary -S : run silently (no output) -F : set up frontend only, don't touch demux -t number : timeout (seconds) -o file : output filename (use -o - for stdout) -h -? : display this help and exit
Note that tzap does not take file system device names; instead, it cobbles them together from the adaptor, front end and demux numbers. If you only have one tuner, you don't need to worry about this detail.
The following sections show typical usage.
Tuning to a programme
To simply tune to a programme, find its name in the .tzap/channels.conf file. The contents look something like this:
NINE Digital: ... NINE HD: ... TEN Digital: ...
See the scan documentation for more details of what the omitted fields mean. Here we're interested in the first field. To tune NINE HD, you run:
$ tzap -r 'nine hd' using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0' reading channels from file '/root/.tzap/channels.conf' tuning to 191625000 Hz video pid 0x0201, audio pid 0x028b status 00 | signal 933f | snr 0000 | ber 00000000 | unc 00000000 | status 1f | signal a70f | snr d0d0 | ber 00000000 | unc 00000000 | FE_HAS_LOCK status 1f | signal aadf | snr cccc | ber 00000000 | unc 00000000 | FE_HAS_LOCK
You need to put the channel name in single or double quotes if it contains spaces; on the other hand, you don't have to match case.
The first four lines show what tzap is doing; they should reflect the corresponding fields in the channels.conf file. The first line of interest starts with "status 00". This shows that the tuner card has been intialized, but no signal has been decoded. The next line shows correct tuning. It repeats with up-to-date information every second.
The information on this line is:
- status: Current status, should be 1f (document me better!)
- signal: Signal strength. The values shown here can vary from card to card, so if yours appears abnormally high or low, it probably means you're using a different card. In general, though, higher values mean better signal.
- snr: The signal to noise ratio. This is more important than the signal strength. Many cards really only supply 8 bits of data (2 digits); the other two may be 00 or repeat the first two, as in this example.
- ber: The bit error rate. This should be as low as possible, preferably 0.
- unc: Uncorrected block errors. This should be 0 for a good signal; if it isn't, you'll have defects in the output stream.
- FE_HAS_LOCK: This indicates that the tuner has tuned ("locked") into the stream.
Recording a programme
There are two ways to record a programme. tzap can copy the data directly to a file:
tzap -o foo 'SBS digital 1'
This variant tunes to SBS digital 1 and then copies the stream to the file foo. It continues until you stop the tzap process.
Alternatively, you can make the MPEG stream available via one of the DVB adaptor devices, typically /dev/dvb/adaptor0/dvr0. For this, you need to specify at least the -r option. If you have more than one tuner and want a different device, for example /dev/dvb/adaptor3/dvr0, use the option '-a 3' as well. You will also probably want to use the -S option to stop the status output every second.
tzap -r -a 3 -S 'SBS digital 1'
You can then copy the stream to a file or view it with mplayer, for example:
cp /dev/dvb/adapter0/dvr0 foo
Exiting after tuning
The -x option tells tzap to exit once it has tuned the tuner. This is only of interest if you don't want to do anything more; when tzap exits, the connection to the tuner also goes away.