If a WebM's DocTypeVersion
is 4, what does that signify and correlate to? Is that version 4 of the Matroska specification draft ? Or does WebM have its own versioning independent of Matroska? I couldn't find any information on webmproject.org
After analyzing a WebM file created by ffmpeg
, I see the "Document Type Version" is 4:
$ ffmpeg -i audio.opus -a:c copy audio.webm
$ mkvinfo audio.webm
+ EBML head
|+ EBML version: 1
|+ EBML read version: 1
|+ Maximum EBML ID length: 4
|+ Maximum EBML size length: 8
|+ Document type: webm
|+ Document type version: 4 <= This is what I'm referencing
|+ Document type read version: 2
WebMs is a type of EBML document.
From https://github.com/cellar-wg/ebml-specification/blob/master/specification.markdown
The version of the EBML Body is found in EBMLDocTypeVersion. A parser for the particular DocType format can read the EBML Document if it can read either the EBMLDocTypeVersion version of that format or a version equal or higher than the one found in EBMLDocTypeReadVersion.
FFmpeg will set version to 4 for WebM if there's an audio stream with codec Opus or if video stream has an alpha channel stored in an additional block or is a stereo video.
The WebM Container Guidelines strongly imply that these versions are the same as the Matroska verion numbers in their note on DocReadTypeVersion
:
DocReadTypeVersion
SHOULD follow the Matroska specification.
- Example: Files with v2 elements should have a
DocReadTypeVersion
of 2.
As far as the meaning of and differences between DocTypeVersion
and related DocTypeReadVersion
, section 21 of version 4 of the draft Matroska Specifications has a good explanation.
DocTypeVersion
MUST be equal to or greater than the highest Matroska version number of anyElement
present in the Matroska file. For example, a file using theSimpleBlock Element
MUST have aDocTypeVersion
equal to or greater than 2. A file containingCueRelativePosition Element
s MUST have aDocTypeVersion
equal to or greater than 4.The
DocTypeReadVersion
MUST contain the minimum version number that a reading application can minimally support in order to play the file back -- optionally with a reduced feature set. For example, if a file contains onlyElement
s of version 2 or lower except forCueRelativePosition
(which is a version 4 MatroskaElement
), thenDocTypeReadVersion
SHOULD still be set to 2 and not 4 because evaluatingCueRelativePosition
is not necessary for standard playback -- it makes seeking more precise if used.
To add to that, SimpleBlock Element
s are version 2 Elements
that contain actual video or audio data, which is why the DocTypeReadVersion
should be 2 if they are used - they have the actual file content! So a player that doesn't support version 2 wouldn't be able to play back the content in those Elements
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.