Abstract

This specification defines a Media Source Extensions byte stream format specification based on the WebM container format.

Status of This Document

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

Table of Contents

1. Introduction

This specification describes a byte stream format based on the WebM container format. 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.

2. MIME-type parameters

This section specifies the parameters that 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.
Codec ID Valid with "audio/webm" Valid with "video/webm"
vorbis true true
opus true true
vp8 false true
vp9 false true
Note
Implementations should support all of the codec IDs mentioned in the table above.

Examples of valid MIME-types with a codecs parameter.

  • audio/webm;codecs="vorbis"
  • video/webm;codecs="vorbis"
  • video/webm;codecs="vp8"
  • video/webm;codecs="vp8,vorbis"
  • video/webm;codecs="vp9,opus"

3. Initialization Segments

A WebM initialization segment must contain a subset of the elements at the start of a typical WebM file.

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

  1. The initialization segment must start with an EBML Header element, followed by a Segment header.
  2. The size value in the Segment header must signal an "unknown size" or contain a value large enough to include the Segment Information and Tracks elements that follow.
  3. A Segment Information element and a Tracks element must appear, in that order, after the Segment header and before any further EBML Header or Cluster elements.
The user agent must accept and ignore any elements other than an EBML Header or a Cluster that occur before, in between, or after the Segment Information and Tracks elements.

4. Media Segments

A WebM media segment is a single Cluster element.

The user agent uses the following rules when interpreting content in a Cluster:

  1. The TimecodeScale in the WebM initialization segment most recently appended applies to all timestamps in the Cluster
  2. The Timecode element in the Cluster contains a presentation timestamp in TimecodeScale units.
  3. The Cluster header may contain an "unknown" size value. If it does then the end of the cluster is reached when another Cluster header or an element header that indicates the start of an WebM initialization segment is encountered.

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

  1. The Timecode element must appear before any Block & SimpleBlock elements in a Cluster.
  2. Block & SimpleBlock elements are in time increasing order consistent with the WebM spec.
  3. If the most recent WebM initialization segment describes multiple tracks, then blocks from all the tracks must be interleaved in time increasing order. At least one block from all audio and video tracks must be present.
The user agent must accept and ignore Cues or Chapters elements that follow a Cluster element.

5. Random Access Points

A SimpleBlock element with its Keyframe flag set signals the location of a random access point for that track. Media segments containing multiple tracks are only considered a random access point if the first SimpleBlock for each track has its Keyframe flag set. The order of the multiplexed blocks must conform to the WebM Muxer Guidelines.

6. Acknowledgments

The editors would like to thank Frank Galligan, and Philip Jägenstedt for their contributions to this specification.