Click here to Skip to main content
Click here to Skip to main content

Sample speed test for Transport Stream construction

, 13 Apr 2004
Rate this:
Please Sign up or sign in to vote.
A program that emulates the TS construction from ES files for the HDTV standard.

What's new:

OK, looking at some of the articles on this site and because of the overall favorable feedback I've received on this program, I've decided to update this article. The program is the same, only the article is improved. So, here it goes, the improved version:

The concept:

This program is about multiplexing more Elementary Streams (usually MPEG 2 files) into a Transport Stream. That's the idea behind HDTV (High Definition TV or Digital TV) standard. That's how your digital TV signal is formed (of course, if you have one). The standard stream chosen for HDTV is MPEG 2, because it has many advantages regarding video & audio streams and formats. A MPEG 2 file (also called Program Stream) contains VIDEO, AUDIO and ancillary data organized in PES (Packetized Elementary Stream) packets.

Here's a link to a program I've developed to deal with MPEG 2 standard: An analyzer for MPEG 2 Program Stream files.

If you want to know more about PES packets, I suggest reading the ISO 138181 documentation (sadly, ANSI has it on sale for 560$ !!!)

The problem resides in multiplexing PES packets into a Transport Stream (TS) and sending this stream over the network at a preferably fixed bit rate. A TS packet is of fixed length - 188 bytes, no matter the type of carried data (audio or video), and one TS packet can carry data from only one PES packet.

So, let's review: you multiplex multiple movie files into a stream that you send over the network. The clients in that network receive your stream and decode it (each client wants only one movie from the stream). Then, the client application plays the stream, and if your Transport Stream isn't adequate, the client might receive a too small amount of data - then you'll see glitches in the player, or, on the opposite, the amount of data received might be excessive and at the client player, frames are discarded.

This program:

Don't think for a moment that this program resolves the issue of HDTV communication. It's just a speedometer, very useful to understand the concept and still functioning as a benchmark. As a note, there are some companies in the Internet offering such a multiplexing software, more or less performing, but if you'll take a look at their software license price, you'll easily understand why nobody will share their sources of such a program on a free basis.

This sample program has the following features:

  • Lets you choose how many ES (Elementary Stream) files you want to generate
  • Lets you chose the size of an ES file
  • Generates ES files filled with a single char
  • Lets you specify the size of the multiplexing buffer
  • Lets you specify the size for PES packet's Header & PES packet's Length
  • Lets you chose how the TS stream will be created (to a file or to "Emulated Network")
  • Generates the multiplexing stream you can read to identify individual TS packets and their content
  • Constructs a diagram for buffer efficiency after each multiplexing process
Main window (at start point):

Sample screenshot

That's how the program looks when started.

Main window (after multiplexing):

Sample screenshot

That's how the program looks after a completed multiplexing process.

TS settings window:

Sample screenshot

Here you can specify PES HEADER & PES PACKET LENGTH to see how the multiplexer does with different values.

About window:

Sample screenshot

This is a window containing some about info, specifications and a calendar.

Diagram window:

Sample screenshot

That's the scalable diagram you can view after completing a multiplexing process.

Legend window:

Sample screenshot

This window is useful if you wish to understand how the output TS stream is formed.

Author notes:

This sample program demonstrates that C# is adequate to write that sort of HDTV multiplexing application. I've heard some voices saying that only C++ and Assembler are suited to reach the desired multiplexing speed (usually around 27 MBit/s) and I wrote this program to demonstrate they are wrong. Anyway, my view is that this program is interesting because of the subject it approaches.

If you want to talk on this subject or you have suggestions regarding this program, please feel free to contact me by e-mail (ro_angel_bv@hotmail.com or ro_angel_bv@fastmail.fm).

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

ro_angel_bv
Web Developer
Malaysia Malaysia
Dumitru Bogdan - alias Angel
 
Born 1980 , Brasov , Romania
 
Final year student at Transilvania University of Brasov , Faculty of Electrical Engineering & Computer Science , Department of Electronics & Computers
 
Programming : Visual C++ , Visual Fox Pro , Assembler & later , C#
 
Motto : "Nothing Last Forever" , and software is no exception

Comments and Discussions

 
GeneralRe: Article Quality Pinmemberro_angel_bv29-Mar-04 20:50 
GeneralRe: Article Quality PinmemberJonathan C Dickinson21-Jul-08 2:26 
GeneralUpload the code, or don't upload at all! Pinmembermrbelles29-Mar-04 12:15 
GeneralSource Code PinsussASerfes29-Mar-04 5:52 
GeneralRe: Source Code Pinmemberro_angel_bv29-Mar-04 20:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 14 Apr 2004
Article Copyright 2004 by ro_angel_bv
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid