A WebM file is encoded exactly like a Matroska file;
see EBML encoding and the Matroska pages for each
element’s ID and type. The
WebM container guidelines say
which elements may be used. They use some older names: Timecode for
Timestamp, TimecodeScale for TimestampScale and SegmentUID for
SegmentUUID.
Rules
- The
DocTypeshould bewebm, and demuxers open only that DocType. - Video is VP8 or VP9, with codec IDs
V_VP8andV_VP9. VP8 has noCodecPrivate. For VP9 it should hold the Profile, Level, Bit Depth and Chroma Subsampling feature data. - The AV1 mapping in the Matroska specification states that it applies equally to
WebM:
V_AV1, with a 4-byteCodecPrivateresembling the start of the ISOBMFF AV1 configuration record (profile, level, bit depth, monochrome and chroma subsampling), optionally followed by Sequence Header or Metadata OBUs. - Audio is Vorbis or Opus, with codec IDs
A_VORBISandA_OPUS. - The only encryption algorithm allowed for
ContentEncAlgois AES, value 5. DisplayUnitmay only be pixels.- Include a
SeekHeadand a key-frame-onlyCueselement, ideally before the Clusters; demuxers disable seeking if there is no such Cues. - Absolute timecodes must increase monotonically.
TimecodeScaleshould be 1,000,000 ns. - Key frames go at the start of Clusters. Audio blocks with the same timecode as a video key frame go in the same Cluster, before the video blocks.
- Muxers should treat the guidelines’ SHOULD as MUST.
Element support
| Group | Supported | Not supported |
|---|---|---|
| EBML | All of the header: EBML, EBMLVersion, EBMLReadVersion, EBMLMaxIDLength, EBMLMaxSizeLength, DocType, DocTypeVersion, DocTypeReadVersion | None |
| Global | Void | CRC-32, SignatureSlot, SignatureAlgo, SignatureHash, SignaturePublicKey, Signature, SignatureElements, SignatureElementList, SignedElement |
| Seek | SeekHead, Seek, SeekID, SeekPosition | None |
| Segment Info | Info, TimecodeScale, Duration, DateUTC, Title, MuxingApp, WritingApp | SegmentUID, SegmentFilename, PrevUID, PrevFilename, NextUID, NextFilename, SegmentFamily, ChapterTranslate and its children |
| Cluster | Cluster, Timecode, PrevSize, SimpleBlock, BlockGroup, Block, BlockAdditions, BlockMore, BlockAddID, BlockAdditional, BlockDuration, ReferenceBlock, DiscardPadding | SilentTracks, SilentTrackNumber, Position, ReferencePriority, ReferenceVirtual, CodecState, Slices, FrameNumber, BlockAdditionID, Delay, SliceDuration, ReferenceFrame, ReferenceOffset, ReferenceTimeCode, EncryptedBlock. Deprecated: BlockVirtual, TimeSlice, LaceNumber |
| Track | Tracks, TrackEntry, TrackNumber, TrackUID, TrackType, FlagEnabled, FlagDefault, FlagForced, MaxCache, DefaultDuration, MaxBlockAdditionID, BlockAdditionMapping, BlockAddIDValue, BlockAddIDName, BlockAddIDType, BlockAddIDExtraData, Name, Language, CodecID, CodecPrivate, TrackOverlay, CodecDelay | FlagLacing, MinCache, DefaultDecodedFieldDuration, TrackTimecodeScale, TrackOffset, CodecName, AttachmentLink, CodecSettings, CodecInfoURL, CodecDownloadURL, CodecDecodeAll, SeekPreRoll, TrackTranslate and its children |
| Video | Video, FlagInterlaced, StereoMode, AlphaMode, PixelWidth, PixelHeight, PixelCropBottom, PixelCropTop, PixelCropLeft, PixelCropRight, DisplayWidth, DisplayHeight, DisplayUnit | AspectRatioType, ColourSpace, GammaValue. Deprecated: FrameRate |
| Colour | Colour and all its children: MatrixCoefficients, BitsPerChannel, the subsampling and siting elements, Range, TransferCharacteristics, Primaries, MaxCLL, MaxFALL, MasteringMetadata and its children | None |
| Audio | Audio, SamplingFrequency, OutputSamplingFrequency, Channels, BitDepth | ChannelPositions, TrackOperation, TrackCombinePlanes, TrackPlane, TrackPlaneUID, TrackPlaneType, TrackJoinBlocks, TrackJoinUID, TrickTrackUID, TrickTrackSegmentUID, TrickTrackFlag, TrickMasterTrackUID, TrickMasterTrackSegmentUID |
| Content encoding | ContentEncodings, ContentEncoding, ContentEncodingOrder, ContentEncodingScope, ContentEncodingType, ContentCompSettings, ContentEncryption, ContentEncAlgo, ContentEncKeyID, ContentEncAESSettings | ContentCompression, ContentCompAlgo, AESSettingsCipherMode, ContentSignature, ContentSigKeyID, ContentSigAlgo, ContentSigHashAlgo |
| Cues | Cues, CuePoint, CueTime, CueTrackPositions, CueTrack, CueClusterPosition, CueRelativePosition, CueDuration, CueBlockNumber | CueCodecState, CueReference, CueRefTime, CueRefCluster, CueRefNumber, CueRefCodecState |
| Attachments | None | All: Attachments, AttachedFile, FileDescription, FileName, FileMimeType, FileData, FileUID, FileReferral, FileUsedStartTime, FileUsedEndTime |
| Chapters | Chapters, EditionEntry, ChapterAtom, ChapterUID, ChapterStringUID, ChapterTimeStart, ChapterTimeEnd, ChapterDisplay, ChapString, ChapLanguage, ChapCountry | EditionUID, EditionFlagHidden, EditionFlagDefault, EditionFlagOrdered, ChapterFlagHidden, ChapterFlagEnabled, ChapterSegmentUID, ChapterSegmentEditionUID, ChapterPhysicalEquiv, ChapterTrack, ChapterTrackNumber, ChapProcess and its children |
| Tags | Tags, Tag, Targets, TargetTypeValue, TargetType, TagTrackUID, SimpleTag, TagName, TagLanguage, TagDefault, TagString, TagBinary | TagEditionUID, TagChapterUID, TagAttachmentUID |
The guidelines predate some newer Matroska elements, such as the Projection group and the language elements in BCP 47 form, and do not list them.