Introduction
WebM is an open, royalty-free media file format for the web, launched by Google in 2010 and maintained by the WebM Project. It plays in all the major web browsers and is widely used for short clips and video on web pages.
A WebM file is a Matroska file restricted to a few open codecs: VP8, VP9 or AV1 for video, and Vorbis or Opus for audio. Audio-only WebM files also exist.
Structure
WebM uses the same EBML element tree as Matroska. The file starts with the EBML header,
ID 1A 45 DF A3, whose DocType is webm. Then comes one Segment
holding the Info, Tracks, Clusters of frames and Cues for seeking. Only the
elements and codecs allowed by the WebM
specification may be used.
0EBML header, DocTypewebmvaries…Segment Info, Tracks, Clusters and Cuesvaries
Not described
Known, not yet covered
- Reference: the pages cover the WebM element subset and the container guidelines of webmproject.org; the Matroska structures they build on are described on the MKV pages, where the Block header layout is still unconfirmed against RFC 9559.
- Viewer: the explorer reads WebM with the same viewer as Matroska, and checks the WebM restrictions (the allowed codecs and track types, the elements the registry marks as part of WebM, pixels only for DisplayUnit, timecodes that only increase). It does not decode video: VP8, VP9 and AV1 frames are listed with their offsets, sizes, timecodes and flags, but no picture is drawn.
- Viewer: Opus and Vorbis sound is decoded and played with the shared decoders; Opus’s DiscardPadding at the end of a stream is not yet applied to the sound, and WebVTT text tracks are listed as frames, not shown as subtitles.
Links
Software
- Firefox – web browser that plays WebM natively (Windows, macOS, Linux, mobile)
- Chrome – web browser that plays WebM natively (Windows, macOS, Linux, mobile)
- VLC media player – free media player that plays WebM files (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player (Windows, macOS, Linux)
- MKVToolNix – free tools that create and edit Matroska and WebM files (Windows, macOS, Linux)
- HandBrake – free video converter that writes WebM (Windows, macOS, Linux)
- FFmpeg – command-line tools that read, write and convert WebM (Windows, macOS, Linux)
Developers
- libavformat – FFmpeg’s container library, which reads and writes WebM (C)
- libwebm – the WebM Project’s reader and writer (C++)
Reference
- WebM container guidelines – the WebM Project’s rules for which Matroska elements and codecs WebM allows
- Matroska element specification – every Matroska element, its ID and its meaning, on matroska.org