The WebM Project | WebM Container Guidelines
Docs
Container
WebM Container Guidelines
Last modified: 2023-10-16
Show Contents
Overview
Goals
Short Term
Long Term
Naming
HTML5 Video Type Parameters
Video Codec
Audio Codecs
canPlayType function
Smart Client
WebM Guidelines
Demuxer and Muxer Guidelines
Muxer Guidelines
VP8/VP9 Alternate Reference Frames
Encode Example
Decode Example
Demuxer Guidelines
WebVTT Guidelines
Storing WebVTT data in a WebM Track
Storing WebVTT cue in a WebM Block
General WebVTT Notes
WebVTT Chapter cues
Implementation Details
EBML Basics
Global Elements (Used throughout the format)
Segment
Meta Seek Information
Segment Information
Cluster
Track
Colour
Location of the Colour Element in an MKV File
Location of the Colour Element in a Stream
Cueing Data
Attachment
Chapters
Tagging
Target Types
VP9 Codec Feature Metadata (CodecPrivate)
Codec Feature Format
ID Byte Format
Length Format
VP9 Feature: Profile
VP9 Feature: Level
VP9 Feature: Bit Depth
VP9 Feature: Chroma Subsampling
Official Tags
Overview
WebM is a digital multimedia container file format promoted by the
open-source WebM Project. It comprises a subset of the Matroska
multimedia container format.
Goals
Short Term
Select a container format that's suitable for VP8/VP9 and ideal for the
open web.
Make it easy for web content providers to create and distribute VP8/VP9
videos.
Long Term
Foster the popularity of our open format so video can be enjoyed
everywhere, with no effort by users.
Naming
Container Format Name
WebM
Filename Extension
.webm
MIME-type
video/webm
Audio-only MIME-type
audio/webm
Uniform Type Identifier
org.webmproject.webm
Video Codec Name
VP8
or
VP9
Audio Codec Name
Vorbis
or
Opus
HTML5 Video Type Parameters
Video Codec
VP8: vp8.X codec is vp8, bitstream is version X.
VP8 currently only has bitstream version 0.
This will also match to a FourCC of VP8X for applications that need a
FourCC.
VP9: vp9.X codec is vp9, bitstream is version X.
VP9 currently only has bitstream version 0.
This will also match to a FourCC of VP9X for applications that need a
FourCC.
The above codec strings will eventually be deprecated in favor of the format
designed for use with MP4 containers
Audio Codecs
Vorbis
Opus
Audio-only files SHOULD have a mime of "audio/webm"
canPlayType function
canPlayType('video/webm') SHOULD return
maybe
canPlayType('audio/webm') SHOULD return
maybe
canPlayType('video/webm; codecs="vp8, vorbis"') SHOULD return
probably
canPlayType('video/webm; codecs="vp8, opus"') SHOULD return
probably
canPlayType('video/webm; codecs="vp9, vorbis"') SHOULD return
probably
canPlayType('video/webm; codecs="vp9, opus"') SHOULD return
probably
canPlayType('audio/webm; codecs="vorbis"') SHOULD return
probably
canPlayType('audio/webm; codecs="opus"') SHOULD return
probably
Note that, currently, the attribute string value "vp8" may also be expressed
as "vp8.0", and "vp9" may be expressed as "vp9.0".
Smart Client
One of the major goals is to allow content creators to have advanced playback
capabilities, such as fast seeking and fast start using only an HTTP server.
To achieve this, the WebM file format guidelines below should be followed when
creating content.
WebM Guidelines
These guidelines are currently for file streaming over an HTTP connection, and
indicate the areas where WebM is strict, relative to the more permissive
Matroska specification
Demuxer and Muxer Guidelines
DocType
element SHOULD be "webm".
Video codec SHOULD be VP8
or
VP9.
The Codec ID SHOULD be "V_VP8"
or
"V_VP9".
There is no
CodecPrivate
data for VP8. For VP9,
CodecPrivate
SHOULD
contain a list of specific VP9 codec features (Level, Profile, Bit
Depth and Chroma Subsampling values) as described in
VP9 Codec Feature Format
Audio codec SHOULD be Vorbis
or
Opus.
Matroska CodecID specification
The Codec ID SHOULD be "A_VORBIS"
or
"A_OPUS".
Initial WebM release does not support subtitles.
WHATWG / W3C RFC will release guidance on subtitles and other overlays
in HTML5