Testing your DVB device

From LinuxTVWiki
Revision as of 19:05, 22 April 2007 by CityK (talk | contribs) (more organizing, edits, removed USA example, created general case example.)
Jump to navigation Jump to search

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.

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 at least have a /dev/dvb/adapter0/ directory. Additional DVB devices installed on your system will be assigned an increased adapter number accordingly.

Using dvb-apps

1. Obtain the dvb-apps package
The LinuxTV dvb-apps have many useful tools with great functionality.

2. Scan for the channels you can receive
The program to use for this step is scan from the LinuxTV dvb-apps. Note: depending on where/how you got the dvb-apps package, the program may be called either '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.

This tries to find the programs it takes from the initial uk-Oxford configuration (or whatever your place is).

For the beginning, do something like this: Adopt this line for your place

 scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/uk-Oxford 

For ATSC:

 $ /usr/bin/scan /usr/share/dvb-apps/atsc/us-ATSC-center-frequencies-8VSB

For North American cable-tv

 $ /usr/bin/scan /usr/share/dvb-apps/atsc/us-Cable-Standard-center-frequencies-QAM256 

It will take a while for scan to search through all the frequencies listed in those initial files, but it will output its progress in the shell. Note that the screen output you get into your shell doesn't really say if you can receive something. On the other hand, if a signal was not found on a particular frequency, you will notice that the output produces "WARNING: >>> tuning failed!!!". Do not be alarmed by such tuning failed messages. Eventually, upon scan completion, a list of services found should be displayed. Here is a sample list for an ATSC scan:

 dumping lists (7 services)
 KPAX-DT:177028615:8VSB:49:52:1
 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

For a DVB-T scan, the output might look like this:

 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 channel BBC ONE is found on frequency 578000000 Hz, and has has the two PIDs 600 and 601 for the video and audio stream.

Next create a "channels.conf", a file in a hidden (dotted) directory off your "home" directory.

For DVB-T:

 mkdir /root/.tzap
 scan /usr/share/doc/dvb-utils/examples/scan/dvb-t/uk-Oxford > /root/.tzap/channels.conf

For ATSC:

 $ 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

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

This file with the data for your TV-programs, if stored into the place as above, can be used by a "zapper" such as tzap

3. Tune a frequncy and program
Use the command tzap for DVB-T, czap for DVB-C, szap for DVB-S and azap with ATSC.

As an example, to automatically tune both channel and PIDs for video and audio to the channel called "KPAX-DT" produced in the ATSC scan output above, run:

 $ /usr/bin/azap  -r -c ~/.azap/channels.conf "KPAX-DT"
 

The output of that azap command would be something like:

 using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
 tuning to 177028615 Hz
 video pid 0x0031, audio pid 0x0034
 status 00 | signal edc0 | snr a122 | ber 00000000 | unc 000000ff |
 status 1f | signal 0000 | snr ff28 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
   ...(repeated updated output) ...

Note: The output will continue to update endlessly, but you can terminate 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.


4. After you've tuned a frequency and program

You could now start up your TV watching application or datastreamer.

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

 dvbtraffic

And finally

 dvbdata

Then for some statistics, try

 $ /usr/bin/dvbtraffic


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

Then 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 harddisk with 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). A good program that can do that (and more) is dvbstream.

Install it, e.g. with debian:

 # apt-get install dvbstream

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

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.

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.


More Software - next steps

You have a lot of choice. MPlayer, Xine, Kaffeine , Klear are probably the first choices selected for light TV watching with a DVB card.

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


Also See