Difference between revisions of "Testing your DVB device"

From LinuxTVWiki
Jump to: navigation, search
m (Save a TV program to your hard drive)
Line 17: Line 17:
$ /usr/bin/''{a,c,s,t}''zap -r -c ~/.''{a,c,s,t}''zap/channels.conf "''channel name''"
$ /usr/bin/''{a,c,s,t}''zap -r -c ~/.''{a,c,s,t}''zap/channels.conf "''channel name''"
where [[azap]] is used for [[ATSC]], [[czap]] for [[DVB-C]], [[szap]] for [[DVB-S]] and [[tzap]] for [[DVB-T]].
where [[azap]] is used for [[ATSC]], [[czap]] for [[DVB-C]], [[szap]] for [[DVB-S]] and [[tzap]] for [[DVB-T]].
If dvbscan is unable to resolve the audio or video PID values for a channel, a manual adjustment in channel.conf is required. The correct values may be determined using using dvbtraffic.

Revision as of 11:31, 9 January 2008

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 device drivers 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. If you have additional DVB devices installed on your system, they will be assigned an increased adapter number accordingly).

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 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
dvbscan /path_to_the_initial_scan_file > ./{a,c,s,t}zap/channels.conf

3. Tune a frequncy 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 azap is used for ATSC, czap for DVB-C, szap for DVB-S and tzap for DVB-T. If dvbscan is unable to resolve the audio or video PID values for a channel, a manual adjustment in channel.conf is required. The correct values may be determined using using dvbtraffic.

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

And finally


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

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

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 good program that can save a stream to disk and more.

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