Testing your DVB device: Difference between revisions

From LinuxTVWiki
Jump to navigation Jump to search
m (fixed links/names)
m (→‎Using dvb-apps: minor edits)
(48 intermediate revisions by 12 users not shown)
Line 1: Line 1:
This page provides a few suggestions on how to test that a DVB card installed on your system is functioning properly. It won't tell you how to install the specific hardware that you have (see [[How to install DVB]] for some generic instructions). Nor does this page describe the use of feature rich viewing software. But it will describe to you some steps on the command line that are indispensable for quick setup and viewing with DVB hardware.
This page provides a few suggestions on how to test that a properly installed DVB device <sup>'''1'''</sup> is functioning correctly. The command line steps described are also indispensable for quick setup and no frills viewing with DVB hardware under Linux.


{{Note|<sup>'''1'''</sup> In other words, this article assumes that you have already both:
Again, '''this article assumes that you have already physically installed the device into your system, and have also installed the driver for your hardware and have the proper modules loaded''' i.e. you should have atleast a ''/dev/dvb/adapter0/'' directory. Extra devices will be assigned an increased ''adapter'' number accordingly.
:* physically installed the device into, or attached it to, your system (refer to the manufacturer's instructions for such details) and
:* installed the drivers for your hardware and have the proper modules loaded (see "[[How to Obtain, Build and Install V4L-DVB Device Drivers]]" for such details)<br>
:Having completed such tasks, you should at least now have a ''/dev/dvb/adapter0/'' directory. (If you have additional DVB devices installed in your system, they will be assigned an increased ''adapter'' number accordingly).}}<br>


== Comparison of DTV testing applications ==
== First step using dvb-utils - create a [[channels.conf]] file ==


The following table lists the main features of the different command line DTV testing utilities. For specific information on usage, have a look at its specific wiki article.
The [[dvb-utils]] have many useful tools with great functionality. To install it on a debian system:
<br>
# apt-get install dvb-utils


{| border=1 cellpadding=10 cellspacing=0 valign="top"
With gentoo:
|- bgcolor=#efefef valign="top"
# emerge linuxtv-dvb-apps
|'''feature \ utility'''
|'''dvb-apps [[zap]]'''
|'''[[Szap-s2]]'''
|'''[[dvbtune]]''' and '''[[dvbstream]]''' from dvbtools
|'''[[dvbsnoop]]'''
|-
|'''download'''
|[http://linuxtv.org/hg/dvb-apps linuxtv.org/hg/dvb-apps]
|[http://mercurial.intuxication.org/hg/szap-s2 http://mercurial.intuxication.org/hg/szap-s2]
|[http://sourceforge.net/projects/dvbtools http://sourceforge.net/projects/dvbtools]
|[http://dvbsnoop.sourceforge.net http://dvbsnoop.sourceforge.net]
|-
|'''supported delivery systems'''
|DVB-S, DVB-C, DVB-T, ATSC
|DVB-S, DVB-S2
|DVB-S, DVB-C, DVB-T
|DVB-S, DVB-C, DVB-T
|-
|'''comments'''
|useful for debugging, but inappropriate for newer delivery systems.
|satellite only.
|outdated.
|outdated, but still the most powerful tool for reading and parsing DVB tables. Hint: use another tool to tune and dvbsnoop in parallel to read data. Unfortunally, dvbsnoop misses support for newer descriptors.
|-
|'''supported features'''
|
* channel scan for legacy systems
* tuning
* streaming
* show signal strength/lock
|
* tuning
|
* tuning (dvbtune)
* streaming (dvbstream)
|
* analyse DVB tables and MPEG streams
* show signal strength/lock
|}


The first step is to scan for the channels you can receive. Depending on where you get your dvb-utils package, the program to use is called 'scan', 'scandvb' or 'dvbscan'. In the following examples, we'll use the name 'scan'.


Scan will need some idea of where to start searching; for this reasons it takes a file for your location as a starting point. Therefore, you need to find channel information for your locality. Again, the location where they are installed may vary. In the following examples, the directory is /usr/share/doc/dvb-utils/examples/scan/dvb-t/; other installations also use /usr/share/doc/dvb-apps-1.1.1 or /usr/local/share/dvb/scan/dvb-t/. DVB-S users should use the folders /usr/share/doc/dvb-utils/examples/scan/dvb-s/, /usr/share/doc/dvb-apps-1.1.1 or /usr/local/share/dvb/scan/dvb-s/. In each case, the name of the file you're looking for is of the form cc-Ttttt, where cc is a two-letter country abbreviation, and Ttttt is the name of the location of the transmitter. So in Adelaide, Australia, you'd look for a file called au-Adelaide; the following example relates to Oxford in the United Kingdom.


== Using dvb-apps ==
'''NB:''' In recent distributions of dvb-utils the '''"scan"''' program has been replaced by '''"scandvb"'''


'''1. Obtain the dvb-apps package'''<BR>
For the beginning, do something like this: Adopt this line for your place
See the [[LinuxTV dvb-apps]] article for details on how to obtain the package. The dvb-apps package contains several useful tools.
scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/uk-Oxford
and you'll see what's coming in to the card. If that makes sense, repeat it like this:
mkdir /root/.tzap
scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/uk-Oxford \
> /root/.tzap/channels.conf
This tries to find the programs it takes from the initial uk-Oxford configuration (or whatever your place is). Note that the screen output you get into your shell doesn't really say if you can receive something or not. The file it creates is more important; it has lines like:
BBC ONE:578000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_3_4:QAM_16:TRANSMISSION_MODE_2K:GUARD_INTERVAL_1_32:HIERARCHY_NONE:600:601:4171
which says that the stream on frequency 578000000 Hz has the two PIDs 600 and 601 for the video and audio stream of BBC ONE. This file with the data for your TV-programs, if stored into the place as above, can be used by the zapper tzap, e.g.:
tzap Bloomberg -- Bloomberg
That tunes automatically both channel and [[PID|PIDs]] for video and audio to the channel called "Bloomberg -- Bloomberg". Use the command [[tzap]] for DVB-T. For DVB-C, replace [[tzap]] with [[czap]] and for DVB-S with [[szap]]. The output of tzap is something like
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
tuning to 778000000 Hz
video pid 0x040f, audio pid 0x040e
status 1f | signal 5100 | snr 6200 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 5100 | snr 6200 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
status 1f | signal 5100 | snr 6200 | ber 00000000 | unc 00000000 | FE_HAS_LOCK#
...
(end it with Ctrl C)
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.


'''2. Scan for the channels you can receive''' <BR>
You could now start up your TV watching application or datastreamer. But we want to see some nice statistics of what's coming in for each channel and PID:
Refer to the [[Scan|(dvb)scan]] article for details of how to perform this step. Once familiar with the content of that article, you will recognize that this step can be summarized (in general form) by:
dvbtraffic
mkdir ~/.''{a,c,s,t}''zap
And finally
(dvb)scan /''path_to_the_initial_scan_file'' > ~/.''{a,c,s,t}''zap/channels.conf
dvbdata
Note: if your signal is too weak and you receive '''only some''' channels, the way to find out which is to look in the channel.conf file that you just created. If for a program the two [[PID|PIDs]] (third and second last number in line) are 0, you can't receive it. If the first [[PID]] is 0 and the second is not 0, then it's probably a radio channel.


Note that you may have both a program <code>scan</code> and <code>dvbscan</code> installed on your system, and only one of them may work.
== First steps using DVBtools - create a [[channels.conf]] (USA OTA Fedora azap example) ==


'''3. Tune a frequency and program'''<BR>
This is adapted from the above UK example showing the use of dvb tools in an installation of Fedora Core 6 2.6.19-1.2895.fc6 using an Air2pc HD5000av PCI dvb board receiving OTA (Over the Air) 8VSB signals in the USA. (Feb 2007)
Refer to the [[Zap|zap]] article for details of how to perform this step. Once familiar with the content of that article, you will recognize that this step can be summarized (in general form) by:
$ /usr/bin/''{a,c,s,t}''zap -r -c ~/.''{a,c,s,t}''zap/channels.conf "''channel name''"
where, respective to the type of transmission, [[azap]] is used for [[ATSC]], [[czap]] for [[DVB-C]], [[szap]] for [[DVB-S]] and [[tzap]] for [[DVB-T]].
Make sure you do not overlook the -r option for setting up the /dev/dvb/adapterX/dvr0 interface. Otherwise, you cannot record data from dvr0.


{{Note|If (dvb)scan was unable to correctly resolve the audio or video [[PID]] values for a channel in the previous step, a manual adjustment to the channels.conf file will be necessary to correct any inaccurately written PID(s) information. Such occurrences tend to be rare, but nonetheless, they do happen -- often, one only becomes aware of a problem with the PID values after unsuccessful attempts to tune a particular channel. The correct values may be determined using using [[dvbtraffic]] (see step '''4.c)''' below). Another method for finding correct PID values for a channel is also outlined in the section entitled "[[Scan#A_word_about_dvbscan_and_audio_streams|A word about dvbscan and audio streams]]".}}
Using Fedora, assume root privileges then install the dvb utilities with
# yum install dvb-apps


First try


'''4. After you've tuned a frequency and program'''<BR>
$ /usr/bin/scandvb /usr/share/dvb-apps/atsc/us-ATSC-center-frequencies-8VSB


'''a)''' You could now start up your simple TV watching application and decode the stream you have tuned.
This should produce output saying "WARNING: >>> tuning failed!!!" if a signal was not found on that particular frequency. Eventually, a list of services found should be displayed. Here is a sample list:


For example, while keeping ''{a,c,s,t}''zap running in the first console shell, open up another console and run
dumping lists (7 services)
mplayer /dev/dvb/adapter0/dvr0 <options>
KPAX-DT:177028615:8VSB:49:52:1
If you have more than one dvb device installed in your system, then you will have to pass the correct ''adaptor'' number. See the [[MPlayer#Usage_with_more_complex_DVB_device_configurations|MPlayer article]] for some further information, as well as the MPlayer man page (i.e. in a console run "man mplayer") for a lengthy list of options.
KPAX-CW:177028615:8VSB:65:68:2
KUFM-HD:551028615:8VSB:49:52:3
KUFM-DT:551028615:8VSB:65:68:4
KTMF-DT:605028615:8VSB:49:52:3
[0001]:605028615:8VSB:49:52:1
KECI-1:629028615:8VSB:49:52:3


Note that if you are attempting to decode us cable-tv QAM from your cable set top box, you might use the file /usr/share/dvb-apps/atsc/us-Cable-Standard-center-frequencies-QAM256 rather than /usr/share/dvb-apps/atsc/us-ATSC-center-frequencies-8VSB


'''b)''' Or, you could now start up a datastreamer
Next try to create a "channels.conf", a file in a hidden (dotted) directory off your "home" directory.
$ mkdir ~/.azap
$ scandvb /usr/share/dvb-apps/atsc/us-ATSC-center-frequencies-8VSB > ~/.azap/channels.conf


Next display the contents of the channels.conf file to make sure the file creation proceeded correctly
$ cat ~/.azap/channels.conf


'''c)''' Or, alternatively, you may want to see some statistics of what's coming in for each channel and PID.
Note: For reasons not readily apparent, tzap used in the UK example above didn't work. So try azap instead, picking the first entry from ~/.azap/channels.conf (The KPAX-DT part)
Example:
$ /usr/bin/azap -r -c ~/.azap/channels.conf "KPAX-DT"
$ /usr/bin/dvbtraffic
which in turn displays lines similar to (terminate with Ctrl-C)


dvbtraffic which will access the [[Device nodes and character devices#DVB character devices|/dev/dvb/adapter0/dvr0 logical device]].
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
An example of output from dvbtraffic is:
tuning to 177028615 Hz
status 1f | signal 0000 | snr ff28 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
... (repeated output) ...


0000 24 p/s 4 kb/s 37 kbit
Then for some statistics, try
0010 20 p/s 3 kb/s 31 kbit
$ /usr/bin/dvbtraffic
0011 20 p/s 3 kb/s 31 kbit
0012 70 p/s 12 kb/s 106 kbit
0015 1 p/s 0 kb/s 2 kbit
0080 26 p/s 4 kb/s 40 kbit
0082 26 p/s 4 kb/s 40 kbit
0087 25 p/s 4 kb/s 38 kbit
0100 25 p/s 4 kb/s 38 kbit
0101 25 p/s 4 kb/s 38 kbit
0102 24 p/s 4 kb/s 37 kbit
<span style="color:#ff0000">0200</span> 8567 p/s 1572 kb/s 12885 kbit <span style="color:#ff0000"> <--- </span>
0201 4708 p/s 864 kb/s 7081 kbit
0205 926 p/s 170 kb/s 1392 kbit
0240 49 p/s 8 kb/s 75 kbit
0241 49 p/s 8 kb/s 75 kbit
<span style="color:#ff0000">028b</span> 261 p/s 47 kb/s 393 kbit <span style="color:#ff0000"> <--- </span>
0294 174 p/s 31 kb/s 262 kbit
0295 130 p/s 23 kb/s 196 kbit
02bc 75 p/s 13 kb/s 113 kbit
1fff 87 p/s 15 kb/s 131 kbit
2000 15329 p/s 2814 kb/s 23055 kbit
-PID--FREQ-----BANDWIDTH-BANDWIDTH-


In this case, for the frequency that has been tuned, PID 0x0200 is for the video stream of an HDTV channel and PID 0x028b is for the associated audio stream (both of these have been highlighted in red in the above output for easier visual identification). These PID values presented by dvbtraffuc are in hexadecimal form and need to be converted to their decimal representation (respectively, 512 and 651) for use in a channel.conf file.<BR>
== First steps using dvbsnoop ==
As an alternative, [[dvbsnoop]] is a small, down-to-earth util. As it's very hardware-near, it's very handy for debugging and seeing what's going on with the card (tuning works? data coming in? signal strong enough?). (On the other side, if all in the section above works fine, you can jump over this section here.)
Install it, e.g. with debian:
# apt-get install dvbsnoop
Apparently, dvbsnoop isn't in any of the usual Fedora repositories at this time (Feb 2007). Instead, download a copy directly from the source forge site using steps similar to the following. Note this is for version 1.40. Your download URL (and the extracted directory ''dvbsnoop-bin-i386-1.4.00-api3'') will change as succeeding versions of dvbsnoop are published on Source Forge. Also you may wish to copy the binary ''dvbsnoop'' out to a more convenient directory in your path, rather than the deeply buried directory ''~/dvbsnoop/dvbsnoop-bin-i386-1.4.00-api3/bin-i386-api3'' which, in this example, contains the binary. Then ''./dvbsnoop'' will not be required, just ''dvbsnoop'' as shown in the debian example below.
$ mkdir ~/dvbsnoop
$ cd dvbsnoop
$ wget http://downloads.sourceforge.net/dvbsnoop/dvbsnoop-bin-i386-1.4.00-api3.tar.gz?modtime=1124046233&big_mirror=0
$ tar xvzf *.tar.gz
$ ls
$ cd dvbsnoop-bin-i386-1.4.00-api3
$ ls
$ cd bin-i386-api3
$ ls
$ ./dvbsnoop -help
$ ./dvbsnoop -s pidscan


This is the line you would create in the file "channel.conf" given the PID values from the dvbtraffic output shown above:
Then try things like

Nine High Def Gold Coast:746625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:<span style="color:#ff0000">512</span>:<span style="color:#ff0000">651</span>:1138

And finally
dvbdate

== Using dvbsnoop ==
If the testing steps in the dvb-apps section above work fine, you can jump over this section here. On the other hand, [[dvbsnoop]] is a small, down-to-earth utility that is very handy for debugging and also seeing what is occuring with a dvb device (i.e. tuning works? data coming in? signal strong enough?).

'''1. Obtain the dvbsnoop package'''<BR>
See the [[dvbsnoop]] article for details on how to obtain the package.

'''2. Testing with dvbsnoop'''<BR>
Try things like
dvbsnoop -help
dvbsnoop -help
dvbsnoop -s pidscan
dvbsnoop -s pidscan
Line 112: Line 143:
The latter will spit out a lot of hexdumps - at least you receive '''something''' ;-)
The latter will spit out a lot of hexdumps - at least you receive '''something''' ;-)


== Save a TV program to harddisk with dvbstream ==
== Save a TV program to your hard drive ==
The handy thing about digital TV is, it comes in as a digital stream that you can save right away to your harddisk without any changes necessary to it. Therefore, hardly any CPU resources are needed -- just a lot of HD space (few GB per hour as the stream is MPEG-2 which is not as compressed as for example DivX/MPEG-4). A good program that can do that (and more) is [[dvbstream]].
The handy thing about digital TV is, it comes in as a digital stream that you can save right away to your harddisk without any changes necessary to it. Therefore, hardly any CPU resources are needed -- just a lot of HD space (few GB per hour as the stream is MPEG-2 which is not as compressed as, for example, DivX/MPEG-4; it's even more as mostly one [[transport stream]] contains multiple [[PID]]s). There are several ways to do this. For example:

'''a) Using the combination of {a,c,s,t}zap and cat'ing the logical dvr device to save a program stream to disk''' <BR>
If you have a channel tuned with {a,c,s,t}zap (and note that you MUST also be using the -r parameter to set up the logical dvr device in order for the following to work; see [[Zap]] for detail), open up another shell console and run (as root user):
cat /dev/dvb/adapter0/dvr0 > <filename>
The result is that particular program stream will be written to disk, and you should be able to play it back at any later time with your favourite media player.

'''b) Using the combination of {a,c,s,t}zap and test_dvr to save an entire transport stream to disk'''



'''c) Saving to disk with dvbstream''' <BR>
Install it, e.g. with debian:
[[dvbstream]] is a useful program that, amongst other things, can save a DVB stream to disk.
# apt-get install dvbstream
'''Method 1''': First tune into a channel, as described above in the zapping step, and then next have dvbstream save a particular stream to file. For example:
tzap 'BBC ONE'
dvbstream 600 601 -o > bbc1.mpeg
The values "600 and 601" are, respectively, the video and audio [[PID]]s for the channel BBC ONE, as derived from the channels.conf file. So this is why it's important that you have your personal channels.conf file with all the PIDs so you can look them up.


'''Method 2''': Alternatively, instead of using a combination of *zap and dvbstream, you can use dvbstream alone provided you pass which frequency to tune and list the correct PIDs. For example:
Let's tune into a channel with tzap as described above, and then you can just save the stream into a file like this:
tzap BBC ONE
dvbstream 600 601 -o >BBC1.mpeg
So this is why it's important that you have your personal channels.conf file with all the PIDs so you can look them up. Instead of using tzap you can do it all in one - tune the frequency and select the right PIDs:
dvbstream -f 578000 600 601 -o >bbc1.mpeg
dvbstream -f 578000 600 601 -o >bbc1.mpeg


Wait a few seconds and then press Ctrl+C to stop. You can open the MPEG file with players that play movie files (decode MPEG2), like Mplayer, (g)xine or noatune.
Wait a few seconds and then press Ctrl+C to stop. You should then be able to open/playback the recorded file with any of your favourite media players (like Mplayer, (g)xine, noatune, etc. etc ) provided you have the correct decoders installed on your system (which, in general regards to DVB transmissions, are usually going to be MPEG-2, but can now also be MPEG-4).


If the file is rather small, e.g. smaller than 1 MB after a minute of recording, then you can't receive this TV channel - maybe the reception is bad (too weak antenna signal) - or maybe your card's frequency is not tuned for the right sender? Watch out, some PIDs come up a few times (but for different frequencies).
If the file is rather small, e.g. smaller than 1 MB after a minute of recording, then you can't receive this TV channel - maybe the reception is bad (too weak antenna signal) - or maybe your card's frequency is not tuned for the right sender? Watch out, some PIDs come up a few times (but for different frequencies).


This might not be what you wanna do every day (unless you only watch BBC1 or you can easily memorise all your channels with their two PIDs) - but it's very fast and easy to do these steps, e.g. for a test.
This might not be what you wanna do every day (unless you only watch BBC1 or you can easily memorise all your channels with their two PIDs) - but it's very fast and easy to do these steps for testing purposes.


==Next steps - More feature rich viewing software ==
It is not the intention of this page to provide a detailed description of the use of DVB hardware with more complex Linux viewing software applications. Suffice it to say that you will have some choice. For example:
* for light TV watching with a DVB device under Linux, [[MPlayer]], [[Xine]], [[Kaffeine]], [[Klear]] and a few others are often selected.
* alternatively, for "Media Center" type applications, the usual first suspects are [[Freevo]], [[MythTV]], and [[VDR]], but there are others as well
* you could use the streaming facilities of [[dvbstream]] and then watch the MPEG-2 stream (even possible on a different computer) with programs like Xine, MPlayer etc.


For some further inspiration on what's possible with more advanced software usage see:
==More Software - next steps ==
* the [[TV Related Software]] page, a commented software list, and
You have a lot of choice. [[MPlayer]], [[Xine]], [[Kaffeine]] , [[Klear]] are probably the first choices selected for light TV watching with a DVB card.
* [[Example setups]]


Alternatively, you could use [[dvbstream]] and then watch the MPEG-2 stream (even possible on a different computer) with programs like Xine, MPlayer etc.


---------
For "Media Center" type applications, the usual first suspects are [[Freevo]], [[MythTV]], and [[VDR]] (note: you'll need to install the [[VDR Software Decoder Plugin]] if you want to use VDR for watching with a software decoding card).


(note: you'll need to install the [[VDR Software Decoder Plugin]] if you want to use VDR for watching with a software decoding card).


== Also See ==
* [[Example setups]] for inspiration on what's possible with more advanced software usage
* [[Commented software list]]
* Digital Video Broadcasting – A practical guide by Hugo Mills [http://www.carfax.org.uk/docs/DVB/]
* Digital Video Broadcasting – A practical guide by Hugo Mills [http://www.carfax.org.uk/docs/DVB/]
[[Category:Drivers]]
[[Category:Software]]

Revision as of 20:05, 9 September 2012

This page provides a few suggestions on how to test that a properly installed DVB device 1 is functioning correctly. The command line steps described are also indispensable for quick setup and no frills viewing with DVB hardware under Linux.

Note: 1 In other words, this article assumes that you have already both:
  • physically installed the device into, or attached it to, your system (refer to the manufacturer's instructions for such details) and
  • installed the drivers for your hardware and have the proper modules loaded (see "How to Obtain, Build and Install V4L-DVB Device Drivers" for such details)
Having completed such tasks, you should at least now have a /dev/dvb/adapter0/ directory. (If you have additional DVB devices installed in your system, they will be assigned an increased adapter number accordingly).


Comparison of DTV testing applications

The following table lists the main features of the different command line DTV testing utilities. For specific information on usage, have a look at its specific wiki article.

feature \ utility dvb-apps zap Szap-s2 dvbtune and dvbstream from dvbtools dvbsnoop
download linuxtv.org/hg/dvb-apps http://mercurial.intuxication.org/hg/szap-s2 http://sourceforge.net/projects/dvbtools http://dvbsnoop.sourceforge.net
supported delivery systems DVB-S, DVB-C, DVB-T, ATSC DVB-S, DVB-S2 DVB-S, DVB-C, DVB-T DVB-S, DVB-C, DVB-T
comments useful for debugging, but inappropriate for newer delivery systems. satellite only. outdated. outdated, but still the most powerful tool for reading and parsing DVB tables. Hint: use another tool to tune and dvbsnoop in parallel to read data. Unfortunally, dvbsnoop misses support for newer descriptors.
supported features
  • channel scan for legacy systems
  • tuning
  • streaming
  • show signal strength/lock
  • tuning
  • tuning (dvbtune)
  • streaming (dvbstream)
  • analyse DVB tables and MPEG streams
  • show signal strength/lock


Using dvb-apps

1. Obtain the dvb-apps package
See the LinuxTV dvb-apps article for details on how to obtain the package. The dvb-apps package contains several useful tools.

2. Scan for the channels you can receive
Refer to the (dvb)scan article for details of how to perform this step. Once familiar with the content of that article, you will recognize that this step can be summarized (in general form) by:

mkdir ~/.{a,c,s,t}zap
(dvb)scan /path_to_the_initial_scan_file > ~/.{a,c,s,t}zap/channels.conf

Note that you may have both a program scan and dvbscan installed on your system, and only one of them may work.

3. Tune a frequency and program
Refer to the zap article for details of how to perform this step. Once familiar with the content of that article, you will recognize that this step can be summarized (in general form) by:

$ /usr/bin/{a,c,s,t}zap  -r -c ~/.{a,c,s,t}zap/channels.conf "channel name"

where, respective to the type of transmission, azap is used for ATSC, czap for DVB-C, szap for DVB-S and tzap for DVB-T. Make sure you do not overlook the -r option for setting up the /dev/dvb/adapterX/dvr0 interface. Otherwise, you cannot record data from dvr0.

Note: If (dvb)scan was unable to correctly resolve the audio or video PID values for a channel in the previous step, a manual adjustment to the channels.conf file will be necessary to correct any inaccurately written PID(s) information. Such occurrences tend to be rare, but nonetheless, they do happen -- often, one only becomes aware of a problem with the PID values after unsuccessful attempts to tune a particular channel. The correct values may be determined using using dvbtraffic (see step 4.c) below). Another method for finding correct PID values for a channel is also outlined in the section entitled "A word about dvbscan and audio streams".


4. After you've tuned a frequency and program

a) You could now start up your simple TV watching application and decode the stream you have tuned.

For example, while keeping {a,c,s,t}zap running in the first console shell, open up another console and run

mplayer /dev/dvb/adapter0/dvr0 <options>

If you have more than one dvb device installed in your system, then you will have to pass the correct adaptor number. See the MPlayer article for some further information, as well as the MPlayer man page (i.e. in a console run "man mplayer") for a lengthy list of options.


b) Or, you could now start up a datastreamer


c) Or, alternatively, you may want to see some statistics of what's coming in for each channel and PID. Example:

 $ /usr/bin/dvbtraffic 

dvbtraffic which will access the /dev/dvb/adapter0/dvr0 logical device. An example of output from dvbtraffic is:

0000    24 p/s     4 kb/s    37 kbit
0010    20 p/s     3 kb/s    31 kbit
0011    20 p/s     3 kb/s    31 kbit
0012    70 p/s    12 kb/s   106 kbit
0015     1 p/s     0 kb/s     2 kbit
0080    26 p/s     4 kb/s    40 kbit
0082    26 p/s     4 kb/s    40 kbit
0087    25 p/s     4 kb/s    38 kbit
0100    25 p/s     4 kb/s    38 kbit
0101    25 p/s     4 kb/s    38 kbit
0102    24 p/s     4 kb/s    37 kbit
0200  8567 p/s  1572 kb/s 12885 kbit    <--- 
0201  4708 p/s   864 kb/s  7081 kbit
0205   926 p/s   170 kb/s  1392 kbit
0240    49 p/s     8 kb/s    75 kbit
0241    49 p/s     8 kb/s    75 kbit
028b   261 p/s    47 kb/s   393 kbit    <--- 
0294   174 p/s    31 kb/s   262 kbit
0295   130 p/s    23 kb/s   196 kbit
02bc    75 p/s    13 kb/s   113 kbit
1fff    87 p/s    15 kb/s   131 kbit
2000 15329 p/s  2814 kb/s 23055 kbit
-PID--FREQ-----BANDWIDTH-BANDWIDTH-

In this case, for the frequency that has been tuned, PID 0x0200 is for the video stream of an HDTV channel and PID 0x028b is for the associated audio stream (both of these have been highlighted in red in the above output for easier visual identification). These PID values presented by dvbtraffuc are in hexadecimal form and need to be converted to their decimal representation (respectively, 512 and 651) for use in a channel.conf file.

This is the line you would create in the file "channel.conf" given the PID values from the dvbtraffic output shown above:

Nine High Def Gold Coast:746625000:INVERSION_AUTO:BANDWIDTH_7_MHZ:FEC_3_4:FEC_3_4:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:512:651:1138

And finally

 dvbdate

Using dvbsnoop

If the testing steps in the dvb-apps section above work fine, you can jump over this section here. On the other hand, dvbsnoop is a small, down-to-earth utility that is very handy for debugging and also seeing what is occuring with a dvb device (i.e. tuning works? data coming in? signal strong enough?).

1. Obtain the dvbsnoop package
See the dvbsnoop article for details on how to obtain the package.

2. Testing with dvbsnoop
Try things like

 dvbsnoop -help
 dvbsnoop -s pidscan

This will give out a lot of numbers, but if you understand the system of DVB you should see if they make sense. Go for one of the PIDs (choose a right one which is a bit difficult as you don't know what they stand for unless you used the scan line above) and try:

 dvbsnoop -s bandwidth <PID>
 dvbsnoop <PID>

The latter will spit out a lot of hexdumps - at least you receive something ;-)

Save a TV program to your hard drive

The handy thing about digital TV is, it comes in as a digital stream that you can save right away to your harddisk without any changes necessary to it. Therefore, hardly any CPU resources are needed -- just a lot of HD space (few GB per hour as the stream is MPEG-2 which is not as compressed as, for example, DivX/MPEG-4; it's even more as mostly one transport stream contains multiple PIDs). There are several ways to do this. For example:

a) Using the combination of {a,c,s,t}zap and cat'ing the logical dvr device to save a program stream to disk
If you have a channel tuned with {a,c,s,t}zap (and note that you MUST also be using the -r parameter to set up the logical dvr device in order for the following to work; see Zap for detail), open up another shell console and run (as root user):

cat /dev/dvb/adapter0/dvr0 > <filename> 

The result is that particular program stream will be written to disk, and you should be able to play it back at any later time with your favourite media player.

b) Using the combination of {a,c,s,t}zap and test_dvr to save an entire transport stream to disk


c) Saving to disk with dvbstream
dvbstream is a useful program that, amongst other things, can save a DVB stream to disk. Method 1: First tune into a channel, as described above in the zapping step, and then next have dvbstream save a particular stream to file. For example:

 tzap 'BBC ONE'
 dvbstream 600 601 -o > bbc1.mpeg

The values "600 and 601" are, respectively, the video and audio PIDs for the channel BBC ONE, as derived from the channels.conf file. So this is why it's important that you have your personal channels.conf file with all the PIDs so you can look them up.

Method 2: Alternatively, instead of using a combination of *zap and dvbstream, you can use dvbstream alone provided you pass which frequency to tune and list the correct PIDs. For example:

 dvbstream -f 578000 600 601 -o >bbc1.mpeg

Wait a few seconds and then press Ctrl+C to stop. You should then be able to open/playback the recorded file with any of your favourite media players (like Mplayer, (g)xine, noatune, etc. etc ) provided you have the correct decoders installed on your system (which, in general regards to DVB transmissions, are usually going to be MPEG-2, but can now also be MPEG-4).

If the file is rather small, e.g. smaller than 1 MB after a minute of recording, then you can't receive this TV channel - maybe the reception is bad (too weak antenna signal) - or maybe your card's frequency is not tuned for the right sender? Watch out, some PIDs come up a few times (but for different frequencies).

This might not be what you wanna do every day (unless you only watch BBC1 or you can easily memorise all your channels with their two PIDs) - but it's very fast and easy to do these steps for testing purposes.

Next steps - More feature rich viewing software

It is not the intention of this page to provide a detailed description of the use of DVB hardware with more complex Linux viewing software applications. Suffice it to say that you will have some choice. For example:

  • for light TV watching with a DVB device under Linux, MPlayer, Xine, Kaffeine, Klear and a few others are often selected.
  • alternatively, for "Media Center" type applications, the usual first suspects are Freevo, MythTV, and VDR, but there are others as well
  • you could use the streaming facilities of dvbstream and then watch the MPEG-2 stream (even possible on a different computer) with programs like Xine, MPlayer etc.

For some further inspiration on what's possible with more advanced software usage see:



(note: you'll need to install the VDR Software Decoder Plugin if you want to use VDR for watching with a software decoding card).

  • Digital Video Broadcasting – A practical guide by Hugo Mills [1]