DVB Inspector


Most people will use DVB inspector "as is", however it can be used as java library to create your own programs.

For example it can be used to generate (fragments of) HTML pages, like this page which lists all services available on the UPC network, and all frequencies used. The source of the program used to generate it is included in the distribution, and is called "CreateHTMLListUPC.java" in the package nl.digitalekabeltelevisie.html.

Below a short introduction of the structure of such a program;

First use the correct imports. Warning: there are also some inner classes with the name TransportStream, but the main one is in the package nl.digitalekabeltelevisie.data.mpeg.

import nl.digitalekabeltelevisie.data.mpeg.PID;
import nl.digitalekabeltelevisie.data.mpeg.TransportStream;
import nl.digitalekabeltelevisie.data.mpeg.pes.AbstractPesHandler;

import nl.digitalekabeltelevisie.data.mpeg.psi.NIT;
import nl.digitalekabeltelevisie.data.mpeg.psi.NITsection;

Now read a TransportStream from file, and parse it for (P)SI data;

TransportStream transportStream = new TransportStream("d:\\test.ts");
try {
   // parse general (P)SI information
} catch (final IOException e) {

At this stage all (P)SI table, like NIT, SDT, etc. are parsed and filled. They can be accessed like this;

The next code fragment will print a list of all the network IDs found in the NIT tables.

final NIT nit = transportStream.getPsi().getNit();
final Map networks = nit.getNetworks();
final TreeSet networksSet = new TreeSet(networks.keySet());
for(final Integer nid: networksSet){
  System.out.println("NetworkID="+nid );

After parseStream() the TransportStream has used the (P)SI data to determine which PIDs contain PES data. If the DVB Inspector 'understands' the data (like MPEG2 Video, or DVB subtitles) a PESHandler is created for the PID. This PESHandler can be used to parse the data.

To read and analyze the PES data we need to tell the transportStream which PIDs we are interested in, and what PESHandlet to use for which PID.

A Map is used to tell the transportStream which PIDs to parse.

The input file will be read again, and only the PIDs which are in the pesHandlerMap are parsed. In the next example only one PID is read, it is possible to read several at the same time.

In this example the pid (512) is hard-coded, normally the PMTs would be used to find out what services and components are available.

// say we want to parse PID 512,
// because we know that has some interesting data, like teletext.
// first get array of all PIDs in the transport stream
PID[] pids = transportStream.getPids();
// create a Map
Map<Integer, AbstractPesHandler> pesHandlerMap =
    new HashMap<Integer, AbstractPesHandler>();
int pidNo = 512; // just as example
PID p = pids[pidNo];
if (p != null) { // check if this PID really exists
  // now get the PESHandler for PID 512, and put it in pesHandlerMap
  pesHandlerMap.put(pidNo, p.getPesHandler());
// parse all PIDs for which pesHandlerMap has an entry

The classes in DVB Inspector are not very well documented. However the structure and naming conventions of the classes and fields corresponds as much as possible to the DVB specifications, so knowledge of these specifications will help you to use this API.

This page was last modified on 7/01/2017