Difference between revisions of "Zap"

From LinuxTVWiki
Jump to: navigation, search
m (links, minor edits)
m (link to W_scan)
(17 intermediate revisions by 6 users not shown)
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 as "zapping"; the term is 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 the spectrum of analog TV software, "zapping" is also the name of a popular Gnome based tv viewer application.
  
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.
+
In terms of DVB software, the abbreviated 'zap' relates 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 really intended for developer use.
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.
+
* 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.
  
 +
==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 33:
 
     -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 numbersIf you only have one tuner, you don't need to worry about this detail.
+
Most experts or experienced users will likely find that this information conveys sufficient details in so far as how to manipulate a specific DVB hardware device with {a,c,s,t}zap'New users', however, are probably left scratching their heads by some of the options listed in the output -- 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, frontend 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 'channels.conf' file, you will discover that its contents are formated something like:
  
If you examine your ''~/.tzap/channels.conf'' file, you will discover that its contents are formated something like this:
+
'''For ATSC''' (unless you saved it elsewhere, the location of the file is in the directory ~/.azap)
 +
KPAX-DT:177028615:8VSB:49:52:1
 +
KPAX-CW:177028615:8VSB:65:68:2
 +
  ...
 +
  ...
 +
KECI-1:629028615:8VSB:49:52:3
  
  NINE Digital: ...
+
'''For DVB-T''' (unless you saved it elsewhere, the location of the file is in the directory ~/.tzap)
NINE HD: ...
+
  ABC HDTV:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2314:0:592
  TEN Digital: ...
+
ABC DiG 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:599
 +
  ...
 +
  ...
 +
  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:1617
  
 
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|scan]] documentation for more details).   
 
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|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:
+
:{{Note|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.}}
  
$ tzap -r 'nine hd'
+
:{{Note|You need the data right format in this file. Different scanning programs produce different output formats. For example [[W_scan|w_scan]] must be run with the '-X' argument to obtain a channels.conf suitable for 'tzap'.}}
  
which should produce output similar to the following:
+
We use the specific name of a channel to tune with tzap. For example, to tune the channel named 'TEN Digital',you would enter the following in the command console:
 +
$ tzap -r 'ten digital'
 +
:{{Note|''You need to put the channel name in single or double quotes if it contains spaces.  On the other hand, as can be seen (and as outlined in the documentation section above), you don't have to match case.''}}
 +
 
 +
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'
 
  reading channels from file '/root/.tzap/channels.conf'
 
  reading channels from file '/root/.tzap/channels.conf'
  tuning to 191625000 Hz
+
  tuning to 219500000 Hz
  video pid 0x0201, audio pid 0x028b
+
  video pid 0x020, audio pid 0x028a
 
  status 00 | signal 933f | snr 0000 | ber 00000000 | unc 00000000 |  
 
  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 a70f | snr d0d0 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
 
  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
 +
  ...(repeated updated output) ...
  
'''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 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 tuningIt repeats with up-to-date information every second.
+
Starting on the fifth line, several fields of information are presentedEach successive line afterwards simply displays the updated state or condition of each of these representative fields.  The updating process will repeat continuously on its own, once every second (i.e. a new line is generated every other second), but you can terminate it at any time with Ctrl-C. In any regard, these information fields are:
  
The information on this line is:
+
*status: The current status of the receiver.<br>You will notice that the value found on the fifth line is "status 00".  This shows that the tuner card has been initialized, but no signal has been decoded.<br>On successive lines, ideally the status value should be 1f (as is the case in the example output), which would indicate that correct tuning is established.<br> The actual bitmapped field possibilities are:
 
+
** 0x01 = FE_HAS_SIGNAL - found something above the noise level
*status: Current status, should be 1f (document me better!)
+
** 0x02 = FE_HAS_CARRIER - found a DVB signal
 +
** 0x04 = FE_HAS_VITERBI - FEC is stable
 +
** 0x08 = FE_HAS_SYNC - found sync bytes
 +
** 0x10 = FE_HAS_LOCK - everything's working...
 +
** 0x20 = FE_TIMEDOUT - no lock within the last ~2 seconds
 +
** 0x40 = FE_REINIT - frontend was reinitialized<br>
 
*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.
 
*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.
 
*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.
Line 68: Line 92:
 
*unc: Uncorrected block errors.  This should be 0 for a good signal; if it isn't, you'll have defects in the output stream.
 
*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.
 
*FE_HAS_LOCK: This indicates that the tuner has tuned ("locked") into the stream.
 +
 +
Not all the numbers are implemented in some drivers, but good is signal > 8000, status 1f (all bits set), snr (Signal to Noise Ratio) should be > 8000, ber (bit error rate)  - low is good, unc (Uncorrectable blocks) - low is good.
  
 
==Recording a program==
 
==Recording a program==
Line 93: Line 119:
  
 
  mplayer /dev/dvb/adapter0/dvr0
 
  mplayer /dev/dvb/adapter0/dvr0
 +
 +
or distribute via network with nc (nc has more options)
 +
#Server
 +
cat /dev/dvb/adapter0/dvr0 | nc -l -p $PortNum
 +
#Client
 +
nc $ServerName $PortNum | mplayer -
  
 
==Exiting after tuning==
 
==Exiting after tuning==
Line 99: Line 131:
 
==Footnote==
 
==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.
+
For users in North America note that szap uses an LO of 10000 for the STANDARD Ku lnb definition. To make szap work with a standard Ku band lnb in North America you can either edit the source code replacing 10000 with 10750 for the STANDARD lnb or run szap like so .....
  
   szap -l STANDARD -r CHANNEL
+
   szap -l 10750 -r CHANNEL
 +
[[Category:Software]]

Revision as of 02:28, 8 November 2009


The process of tuning a television channel is sometimes referred to as "zapping"; the term is 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 the spectrum of analog TV software, "zapping" is also the name of a popular Gnome based tv viewer application.

In terms of DVB software, the abbreviated 'zap' relates 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 really intended 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 that this information conveys sufficient details in so far as how to manipulate a specific DVB hardware device with {a,c,s,t}zap. 'New users', however, are probably left scratching their heads by some of the options listed in the output -- 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, frontend and demux numbers. If you only have one tuner, you don't need to worry about this detail.

Tuning a channel

If you examine your 'channels.conf' file, you will discover that its contents are formated something like:

For ATSC (unless you saved it elsewhere, the location of the file is in the directory ~/.azap)

KPAX-DT:177028615:8VSB:49:52:1
KPAX-CW:177028615:8VSB:65:68:2
  ...
  ...
KECI-1:629028615:8VSB:49:52:3

For DVB-T (unless you saved it elsewhere, the location of the file is in the directory ~/.tzap)

ABC HDTV:226500000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:2314:0:592
ABC DiG 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:599
  ...
  ...
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:1617

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).

Note: 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.
Note: You need the data right format in this file. Different scanning programs produce different output formats. For example w_scan must be run with the '-X' argument to obtain a channels.conf suitable for 'tzap'.

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

$ tzap -r 'ten digital'
Note: You need to put the channel name in single or double quotes if it contains spaces. On the other hand, as can be seen (and as outlined in the documentation section above), you don't have to match case.

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 219500000 Hz
video pid 0x020, audio pid 0x028a
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
 ...(repeated updated output) ...

The first four lines in the above output show what tzap is doing; they should reflect the corresponding fields in the channels.conf file.

Starting on the fifth line, several fields of information are presented. Each successive line afterwards simply displays the updated state or condition of each of these representative fields. The updating process will repeat continuously on its own, once every second (i.e. a new line is generated every other second), but you can terminate it at any time with Ctrl-C. In any regard, these information fields are:

  • status: The current status of the receiver.
    You will notice that the value found on the fifth line is "status 00". This shows that the tuner card has been initialized, but no signal has been decoded.
    On successive lines, ideally the status value should be 1f (as is the case in the example output), which would indicate that correct tuning is established.
    The actual bitmapped field possibilities are:
    • 0x01 = FE_HAS_SIGNAL - found something above the noise level
    • 0x02 = FE_HAS_CARRIER - found a DVB signal
    • 0x04 = FE_HAS_VITERBI - FEC is stable
    • 0x08 = FE_HAS_SYNC - found sync bytes
    • 0x10 = FE_HAS_LOCK - everything's working...
    • 0x20 = FE_TIMEDOUT - no lock within the last ~2 seconds
    • 0x40 = FE_REINIT - frontend was reinitialized
  • 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.

Not all the numbers are implemented in some drivers, but good is signal > 8000, status 1f (all bits set), snr (Signal to Noise Ratio) should be > 8000, ber (bit error rate) - low is good, unc (Uncorrectable blocks) - low is good.

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

or distribute via network with nc (nc has more options)

#Server
cat /dev/dvb/adapter0/dvr0 | nc -l -p $PortNum
#Client
nc $ServerName $PortNum | mplayer -

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 users in North America note that szap uses an LO of 10000 for the STANDARD Ku lnb definition. To make szap work with a standard Ku band lnb in North America you can either edit the source code replacing 10000 with 10750 for the STANDARD lnb or run szap like so .....

 szap -l 10750 -r CHANNEL