This specification defines a [[MEDIA-SOURCE]] byte stream format specification based on MPEG-2 Transport Streams.

The working group maintains a list of all bug reports that the editors have not yet tried to address; there may also be related open bugs in the [[MEDIA-SOURCE]] repository.

Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should track the GitHub repository and take part in the discussions.


This specification defines segment formats for implementations of [[!MEDIA-SOURCE]] that choose to support MPEG-2 Transport Streams [[!MPEG2TS]].

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

MIME-type info

The MIME-type/subtype pair of "video/MP2T", as specified in [[!RFC3551]], MUST be used for byte streams that conform to this specification.

This following parameters can be used in the MIME-type passed to or .

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 [[!RFC6381]].
Implementations MAY only implement a subset of the codecs and profiles mentioned in the RFC.

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 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.

Initialization Segments

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

The user agent MUST run the if any of the following conditions are met:

  1. A PAT is not present in the
  2. A PMT is not present in the

The user agent MUST accept and ignore other SI, such as CAT, that are invariant for all subsequent media segments.

The user agent MUST source attribute values for id, kind, label and language for , and objects as described for MPEG-2 Transport Streams in the in-band tracks spec [[INBANDTRACKS]].

Media Segments

The user agent MUST run the 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.

Random Access Points

A random access point as defined in this specification corresponds to Elementary Stream Random Access Point as defined in [[!MPEG2TS]].

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 for the . 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:


The editors would like to thank for their contributions to this specification.