Processing Digital Television (ATSC)This site describes the digital television (ATSC) transport stream (TS) files and how to process them. This information will allows you to write programs to:
The FormatThe ATSC format is defined formally in several lengthy documents on the ATSC site. The key documents are:
The HardwareTo capture over-the-air (OTA) ATSC signals now available throughout the US, you'll need an ATSC capture card. I use and recommend ones from pcHDTV. With the pcHDTV you can use the provided command-line tools or the DVR program pchdtvr to record transport stream files. These files are typically large since the captured ATSC signal contains about 9GB per hour of data.
Processing BasicsOK, you have a multi-gigabyte TS file. What's in there?
The first thing to know is that the TS file consists of 188-packets. The whole file (if it is not corrupted) is one 188-byte packet after another.
Each packet starts with a 4-byte header.
Program Association TableIf the PID is 0, immediately following the 4-byte header is a 1-byte pointer field. If the "Start of data table" is true, then the pointer indicates the number of bytes past the pointer field where the PAT begins. The PAT header has these fields:
Interesting PIDsEach packet has a PID. A collection of packets that share a PID for a stream. Some streams carry a video channel, some carry audio data. Others carry other information, such as the association between video and audio data, and channel guides.
Here is a list of some common PIDs you'll see and what they are used for:
Copyright © 2020 Andrew Oliver