W3C

MPEG-2 TS Byte Stream Format

W3C Editor's Draft 04 November 2013

This version:
http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html
Latest published version:
http://www.w3.org/TR//
Latest editor's draft:
http://dvcs.w3.org/hg/html-media/raw-file/default/media-source/mp2t-byte-stream-format.html
Editors:
Aaron Colwell, Google Inc.
Adrian Bateman, Microsoft Corporation
Mark Watson, Netflix Inc.

Abstract

This specification defines a Media Source Extensions byte stream format specification based on MPEG-2 Transport Streams.

Status of This Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This document was published by the HTML Working Group as an Editor's Draft. If you wish to make comments regarding this document, please send them to public-html-media@w3.org (subscribe, archives). All comments are welcome.

Publication as an Editor's Draft does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of Contents

1. Introduction

This specification defines segment formats for implementations that choose to support MPEG-2 Transport Streams (MPEG-2 TS) specified in ISO/IEC 13818-1.

It defines the MIME-type parameters used to signal codecs, and provides the necessary format specific definitions for initialization segments, media segments, and random access points required by the byte stream formats section of the Media Source Extensions spec. This document also defines extra behaviors and state that only apply to this byte stream format.

2. MIME-type info

The MIME-type/subtype pair of "video/MP2T", as specified in RFC 3551, must be used for byte streams that conform to this specification.

This following parameters can be used in the MIME-type passed to isTypeSupported() or addSourceBuffer().

codecs
A comma separated list of codec IDs used to specify what codecs will be used in the byte stream. Implementations should accept IDs in the form specified by RFC 6381.
Note
Implementations may only implement a subset of the codecs and profiles mentioned in the RFC.

3. General Transport Stream Requirements

MPEG-2 TS media and initialization segments must conform to the MPEG-2 TS Adaptive Profile (ISO/IEC 13818-1:2012 Amd. 2).

The user agent must run the end of stream algorithm with the error parameter set to "decode" if any of the following conditions are met:

  1. Segments do not contain complete MPEG-2 TS packets.
  2. Segments do not contain complete PES packets and sections.
  3. Segments contain more than one program.
  4. At least one MPEG-2 TS packet has a non-zero transport_error_indicator.

4. Initialization Segments

An MPEG-2 TS initialization segment consists of a single PAT and a single PMT.

The user agent must run the end of stream algorithm with the error parameter set to "decode" if any of the following conditions are met:

  1. A PAT is not present in the initialization segment
  2. A PMT is not present in the initialization segment
The user agent must accept and ignore other SI, such as CAT, that are invariant for all subsequent media segments.

5. Media Segments

The user agent must run the end of stream algorithm with the error parameter set to "decode" if any of the following conditions are met:

  1. A media segment relies on initialization information in another media segment.
  2. At least one PES packet does not have a PTS timestamp.
  3. PCR is not present in the Segment prior to the first byte of a TS packet payload containing media data.
The user agent will accept and ignore PSI that is identical to the information in the last initialization segment which may appear repeatedly throughout the segment.

6. Random Access Points

A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in ISO/IEC 13818-1.

7. Timestamp Rollover & Discontinuities

Timestamp rollovers and discontinuities must be handled by the UA. The UA's MPEG-2 TS implementation must maintain an internal offset variable, MPEG2TS_timestampOffset, to keep track of the offset that needs to be applied to timestamps that have rolled over or are part of a discontinuity. MPEG2TS_timestampOffset is initially set to 0 when the SourceBuffer is created. This offset must be applied to the timestamps as part of the conversion process from MPEG-2 TS packets into coded frames for the coded frame processing algorithm. This results in the coded frame timestamps for a packet being computed by the following equations:

        Coded Frame Presentation Timestamp = (MPEG-2 TS presentation timestamp) + MPEG2TS_timestampOffset
        Coded Frame Decode Timestamp = (MPEG-2 TS decode timestamp) + MPEG2TS_timestampOffset

MPEG2TS_timestampOffset is updated in the following ways:

8. Acknowledgments

The editors would like to thank Alex Giladi, Bob Lund, David Singer, Duncan Rowden, Glenn Adams, Mark Vickers, and Michael Thornburgh for their contributions to this specification.
See a problem? Select text and .