Generating A Transport Stream

Important note: References to any products in this tutorial should not be taken as recommendations for or against those products. There are a lot of suitable products in this area, and you should choose the ones that suit you best.

Before you can play a transport stream to your STB, you need to have a suitable transport stream.

In some cases, you may be able to use a transport stream that you have recorded off the air or that you have received from another source. If you are getting started and looking for a transport stream, you can download a free MHP transport stream from Cineca, courtesy of Fondazione Bordoni – be warned, however, it’s a 500MB download, and it does not include any DSM-CC object carousels. At other times, you may want to generate your own transport stream that includes your application, a DSM-CC object carousel, a data stream or a set of stream events.

Since transport streams can contain several different types of data, we’ll take a closer look at these in turn. For now, we will assume that you are building a transport stream that contains one service: for most testing purposes, this is all you will need. A transport stream can contain more than one service, and the process to do this is fairly similar to generating a transport stream containing only one service. For this case, we will assume that your transport stream will contain one video stream, one audio stream, and one object carousel for an MHP application. The basic process is shown in the diagram below:

Generating an MPEG-2 transport stream.

Generating a transport stream

Video and audio

The first step is capturing and encoding your video and audio. We won’t go into the capturing process in any detail because there are so many ways of doing it, but you should take the following points into account when encoding your video:

  • All video and audio should be encoded as MPEG-2. No other formats are supported by MHP or OCAP
  • Video should have a resolution of 720×576 at 25 frames per second (for MHP) or 640×480 at 30 frames per second (for OCAP).
  • The encoded video and audio can be stored in separate files (as elementary streams), in a single file as a program stream or in a single file as a transport stream. Most equipment will be able to handle all of these formats.

Application files and application signalling

As well as the video and audio, you need to generate a stream that contains the object carousel in which your application files are stored. To do this, you need an object carousel generator, also known as a "datacasting server" or a "content transmission server". These can be either a software package suitable for use on a test system, or a standalone solution such as the CORAL MHP broadcasting server from Thales. The object carousel generator will take a directory structure containing all of the files needed by an application and will generate an MPEG stream containing the object carousel for that directory structure. Most object carousel generators will also generate the application signalling that the target STB needs to start the application, and so they will typically generate a transport stream containing two elementary streams; one for the object carousel and one for the application signalling.

Most of the standalone products will provide an ASI output, and so if you’re doing everything else using software tools on a standard PC you will need some way of capturing this output to a file. This has a few problems (namely, making sure that you get all of the object carousel and associated signaling), but there are a few software object carousel generators that can output the object carousel to a file. SoftOC from Strategy & Technology is one such example, as is MediaSphere Lab from Softel. The LinuxTV project also offers the open-source dsmcc-mhp-tools package, but it’s not clear how complete this is. Cineca also offer the Just-DVB-It package for DSM-CC generation, which is available under the GPL.

One thing to remember is that any object carousel generator you choose must be MHP or OCAP compliant. Not every object carousel generator will be able to generate the application signalling information, and so some solutions may need you to provide this separately. This can be hard work, and so it’s better to choose a solution that can generate it automatically.

In production environments, an object carousel generator will often have a link to a content management system so that it can feed the correct applications and application signalling to the multiplexer at the correct time. For simple prototyping, this isn’t really necessary.

Stream events

Some applications may use stream events to synchronize the application with the contents of the video. Since stream events are markers that are placed in the MPEG stream, these also have to be included in our transport stream if we want to use them.

Because stream events are closely linked to the object carousel, most object carousel generators will also support generating stream events. These will be contained within the transport stream produced by the object carousel generator, typically as a separate elementary stream.

Putting it all together

Once we’ve finished generating the object carousel, we have all of the elements we need to build our transport stream. The next step is to combine the video stream, audio stream and object carousel into a transport stream. To do this we use a multiplexer, which will combine all of the streams we have so far and add some additional service information so that the target STB can find the streams properly. As with other head-end equipment, multiplexers come in two types:

  1. Professional multiplexers like the Adtec Edje-3000 receive their input data over ASI connections. These expensive devices can multiplex several services into one transport stream in real-time and then output it over another ASI connection, and this type of multiplexer is used in digital TV head-ends.
  2. Software multiplexers take data streams stored in files and multiplex them into a transport stream stored in another file. These may or may not work in real-time, and are typically used more for testing because they are cheaper and easier to configure. Some analysis or playout systems such as the Tektronix AD-952 will include a software multiplexer.

There are several open-source projects that offer MPEG multiplexers, and many companies offer commercial tools to do this. When choosing a software multiplexer, there are several features that the multiplexer must support:

  • It must support transport stream output. This may seem obvious, but many multiplexers do not support this.
  • It most support transport streams containing multiple services, or at least provide some way of inserting additional DVB service information or PSIP.
  • It must be able to support data streams as well as just audio and video.

As for object carousel generators, standalone multiplexers will often output the transport stream over an ASI connection. If you want to use the stream in a separate playout system, you will need to capture the stream using a transport stream recorder. Otherwise, we can simply feed the ASI output into a standalone modulator ready for transmission to the STB. Software multiplexers will need a separate playout system since the resulting transport stream will usually be stored in a file.

At this point, you will have a complete transport stream ready to be used with your playout system. We have already discussed playing a transport stream to your STB elsewhere in this tutorial, and so we won’t cover it here in any more detail.

Depending on exactly what you want to test, you may need to encode other data in your transport stream before you send it to the STB. The table below shows the different types of stream that can be included in a transport stream, their purpose, and how you can generate them:

Elements of an MPEG-2 transport stream and how to generate them.
Stream type Description Generated by
Video streams The video for the show that your application is associated with (or any shown on the appropriate channel if your application is not tied to a particular show). MPEG encoder. Make sure you get the encoding parameters right!
Audio streams The audio that goes with your video. You can include several audio streams in one service (e.g. different languages). MPEG encoder. Make sure you get the encoding parameters right!
Service information A set of streams that describe how your service is organized and that tell the receiver where to find the data that it needs. This will be either DVB-SI or PSIP, depending on whether you are generating MHP or OCAP transport streams. Generated by the multiplexer. Some data may come from external files or another external source, depending on the multiplexer being used.
DSM-CC object carousel A broadcast filesystem that may contain MHP/OCAP applications and data files. Generated by the object carousel generator.
Application signalling Special service information that tells your applications when to start and from where to load their files. Typically generated by the object carousel generator.
Private data streams Any proprietary data streams that are needed by your application. Generated by proprietary tools.
Stream events Markers in the stream that act as synchronization points for an application. These may also require DSM-CC Normal Play Time (NPT) references to be included. Typically generated by the object carousel generator.

Not every stream that you generate will contain all of these elements. For simple application testing, only service information, application signalling and an object carousel is really necessary, although many test transport streams will also include at least one video and audio stream.

Open source tools

Given the expense of tools for the digital TV industry, it’s not surprising that many people would like to find open-source solutions or other free tools that lets them generate a transport stream that they can use with MHP. There is some good news here, but it’s still not clear whether there is a reliable way of creating a transport stream using only free software.

Encoding

The MPEG-2 encoder from the MPEG Software Simulation Group is an open-source encoder that is really only useful for generating I-frames or video drips. It’s not much use for generating long sequences of MPEG. For this task, you really need a commercial solution. If your budget can’t stretch to a professional encoder, then there are some decent software packages available.

Probably the cheapest way to encode MPEG video is to use TMPGEnc. The free version provides a 30-day trial of its MPEG encoding features, while the full version costs only 37 USD. The bbMPEG tools also include a tool for converting AVI files to MPEG-2, but it’s not clear what formats of AVI are supported. Other open source solutions such as the MJPEG tools and FFMPEG also allow MPEG-2 encoding, but it’s not clear whether they support the formats of MPEG-2 needed by a DTV receiver.

Video editing tools such as Adobe Premiere and Apple’s Final Cut Pro will also generate MPEG video, but they cost more.

Object carousel generation

The dsmcc-mhp-tools project provides a DSM-CC object carousel generator that also generates application signalling information, DSM-CC Normal Play Time (NPT) references and DSM-CC stream events.

Multiplexing

The iso 13818 stream multiplexer software supports multiplexing MPEG-2 transport streams, but will only include MPEG program-specific information in the generated transport stream. It will not add any DVB service information.

No open-source SI generators are available at the moment, and so you will need to generate a set of elementary streams containing your SI data if you want to use this multiplexer to produce an MHP-compatible transport stream.