Difference between revisions of "Zap"

From LinuxTVWiki
Jump to: navigation, search
m (links, minor edits)
(continued with the rework)
Line 2: Line 2:
  
  
The process of tuning a television channel is sometimes referred to by the term "zapping" (apparently in reference to the use of early Set Top Boxes " which could let you zap through a channel list but not much more" [The Linux DVB API]).   
+
The process of tuning a television channel is sometimes referred to by the term "zapping"; apparently in reference to the use of early Set Top Boxes " which could let you zap through a channel list but not much more" (see [http://linuxtv.org/downloads/linux-dvb-api-v4/ The Linux DVB API]).   
  
Within the [[LinuxTV dvb-apps]] package are four similar command line utility programs (''azap'', ''czap'', ''szap'' and ''tzap'') that respectively allow the user to tune a [digital television channel] from a [[ATSC]], [[DVB-C]], [[DVB-S]] or [[DVB-T]] transmission.
+
In terms of DVB software, zap has reference to several small command line utilities found in the contents of the [[LinuxTV dvb-apps]] package.
 +
* The program zap (found within the ~/dvb-apps/util/zap directory of the package download) is intended just for developer use.
 +
* The four {a,c,s,t}zap utility programs (all found within the ~/dvb-apps/util/szap directory of the package download), on the other hand, are highly useful for the end user in setting up and testing dvb hardware devices.  A given '_zap' command (''azap'', ''czap'', ''szap'' or ''tzap'') will respectively allow the user to tune a [[Digital TV|digital television (DTV)]] channel from a [[ATSC]], [[DVB-C]], [[DVB-S]] or [[DVB-T]] transmission.  It is these utilities that will be discussed in the remainder of this article.
  
In order to use a {a,c,s,t}zap utility, the user must first create a channel configuration file with the ''[dvb]scan'' utility, also found in the [[LinuxTV dvb-apps|dvb-apps]] package -- see the [[Scan|scan]] documentation for details. The following sections show typical usage of a zap utility on the command line, and assume that the user has already created/setup a valid channels.conf file.
 
 
For purposes of illustration, the ''tzap'' utility is used, however, the information should largely be applicable for usage with the other ''_zap'' programs as well.
 
  
 +
==Introduction==
 +
In order to successfully tune with an {a,c,s,t}zap utility, the user must first have a valid channel configuration file (channels.conf) setup.  A channels.conf file is generated by running the '[dvb]scan' utility, which is also found in the [[LinuxTV dvb-apps|dvb-apps]] package -- see the [[Scan|scan]] documentation for specific details on how to create a channels.conf file. The '_zap' usage examples shown below assume that the user has already undertaken those steps to setup their channels.conf file.
  
 
==Documentation==
 
==Documentation==
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:
+
Within the dvb-apps package download itself (~/dvb-apps/util/szap directory) you will find a README file that gives a very brief explanation of how to use the {a,c,s,t}zap utilites.  
  
 +
Otherwise, passing an {a,c,s,t}zap command with the -h option, or without any parameters, will provide a summary of the commands usage. For example, running 'tzap' produces:
 +
usage:
 
       tzap [options] <channel_name>
 
       tzap [options] <channel_name>
 
         zap to channel channel_name (case insensitive)
 
         zap to channel channel_name (case insensitive)
Line 29: Line 32:
 
     -h -?    : display this help and exit
 
     -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.
+
Most experts or experienced users will likely find this information sufficient for there needs.  Plebians, or 'new users', are probably left scratching their heads -- but fear not!
 +
 
 +
One thing that is noteworthy from the output above is 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.
  
  
 
==Tuning a channel==
 
==Tuning a channel==
  
If you examine your ''~/.tzap/channels.conf'' file, you will discover that its contents are formated something like this:
+
For purposes of illustration, use of the 'tzap'' utility is continued, however, the information contained in the following examples should largely be applicable for usage with the other ''_zap'' programs as well.
 +
 
 +
 
 +
If you examine your 'channels.conf' file (in this case, found in the directory ~/.tzap), you will discover that its contents are formated something like this:
  
 
  NINE Digital: ...
 
  NINE Digital: ...
Line 46: Line 54:
 
  $ tzap -r 'nine hd'
 
  $ tzap -r 'nine hd'
  
which should produce output similar to the following:
+
'''''Note''''': '''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 (as outlined in the example in the documentation section above).'''
 +
 
 +
Running that command should produce output similar to the following:
  
 
  using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
 
  using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
Line 56: Line 66:
 
  status 1f | signal aadf | snr cccc | ber 00000000 | unc 00000000 | FE_HAS_LOCK
 
  status 1f | signal aadf | snr cccc | ber 00000000 | unc 00000000 | FE_HAS_LOCK
  
'''Note''': 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 in the above output show what ''tzap'' is doing; they should reflect the corresponding fields in the ''channels.conf'' file.  The next item of interest is the fifth line, "status 00".  This shows that the tuner card has been initialized, but no signal has been decoded.  The next line shows correct tuning is then establishedUp-to-date information will then be repeated continuously every second.
 
+
The first four lines of the above example output show what ''tzap'' is doing; they should reflect the corresponding fields in the ''channels.conf'' file.  The next item of interest is the fifth line, "status 00".  This shows that the tuner card has been initialized, 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:
 
The information on this line is:

Revision as of 03:41, 29 March 2007


The process of tuning a television channel is sometimes referred to by the term "zapping"; apparently in reference to the use of early Set Top Boxes " which could let you zap through a channel list but not much more" (see The Linux DVB API).

In terms of DVB software, zap has reference to several small command line utilities found in the contents of the LinuxTV dvb-apps package.

  • The program zap (found within the ~/dvb-apps/util/zap directory of the package download) is intended just for developer use.
  • The four {a,c,s,t}zap utility programs (all found within the ~/dvb-apps/util/szap directory of the package download), on the other hand, are highly useful for the end user in setting up and testing dvb hardware devices. A given '_zap' command (azap, czap, szap or tzap) will respectively allow the user to tune a digital television (DTV) channel from a ATSC, DVB-C, DVB-S or DVB-T transmission. It is these utilities that will be discussed in the remainder of this article.


Introduction

In order to successfully tune with an {a,c,s,t}zap utility, the user must first have a valid channel configuration file (channels.conf) setup. A channels.conf file is generated by running the '[dvb]scan' utility, which is also found in the dvb-apps package -- see the scan documentation for specific details on how to create a channels.conf file. The '_zap' usage examples shown below assume that the user has already undertaken those steps to setup their channels.conf file.

Documentation

Within the dvb-apps package download itself (~/dvb-apps/util/szap directory) you will find a README file that gives a very brief explanation of how to use the {a,c,s,t}zap utilites.

Otherwise, passing an {a,c,s,t}zap command with the -h option, or without any parameters, will provide a summary of the commands usage. For example, running 'tzap' produces:

usage:
      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

Most experts or experienced users will likely find this information sufficient for there needs. Plebians, or 'new users', are probably left scratching their heads -- but fear not!

One thing that is noteworthy from the output above is 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.


Tuning a channel

For purposes of illustration, use of the 'tzap utility is continued, however, the information contained in the following examples should largely be applicable for usage with the other _zap programs as well.


If you examine your 'channels.conf' file (in this case, found in the directory ~/.tzap), you will discover that its contents are formated something like this:

NINE Digital: ...
NINE HD: ...
TEN Digital: ...

What we're interested in here is the channel name contained in the first field of each line. (If you are interested in what the omitted fields mean, see the scan documentation for more details).

We use the specific name of a channel to tune with tzap. For example, to tune the channel named 'NINE HD',you would enter the following in the command console:

$ tzap -r 'nine hd'

Note: 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 (as outlined in the example in the documentation section above).

Running that command should produce output similar to the following:

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

The first four lines in the above output show what tzap is doing; they should reflect the corresponding fields in the channels.conf file. The next item of interest is the fifth line, "status 00". This shows that the tuner card has been initialized, but no signal has been decoded. The next line shows correct tuning is then established. Up-to-date information will then be repeated continuously 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 program

There are two ways to record a program. 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.

Or, to record a channel for a specified period of time (this could be run from at to record at a specific time):

tzap -t 3600 -o foo.ts "BBC ONE"

(This records from the channel BBC ONE for 1 hour (3600 seconds)).

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

or

mplayer /dev/dvb/adapter0/dvr0

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.

Footnote

For tuning dvb-s channels szap currently does not have an lnb type defined that will work with standard Ku LO: 10750 lnbs such as are commonly used in North America. Download the source for dvb-apps and in util/lib/lnb.c edit the standard_desc from 10000 to 10750. There are two spots to edit. One at about line 20 and again at about line 38. You'll probably want to do the same for util/scan/lnb.c. Run make and the newly compiled versions will now tune channels using your 10750 Ku lnb or lnbf.

 szap -l STANDARD -r CHANNEL