WebM DocType 版本表示什么?

What does WebM DocType Version Signify?

如果 WebM 的 DocTypeVersion 是 4,那意味着什么并与什么相关?那是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

分析由 ffmpeg 创建的 WebM 文件后,我看到“文档类型版本”是 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 是一种 EBML 文档。

来自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.

如果存在带有编解码器 Opus 的音频流,或者如果视频流具有存储在附加块中的 alpha 通道或者是立体声视频,FFmpeg 会将 WebM 的版本设置为 4。

WebM Container Guidelines 强烈暗示这些版本与他们在 DocReadTypeVersion 上的注释中的 Matroska 版本号相同:

  • DocReadTypeVersion SHOULD follow the Matroska specification.
    • Example: Files with v2 elements should have a DocReadTypeVersion of 2.

关于DocTypeVersion和相关DocTypeReadVersion的含义和区别,section 21 of version 4 of the draft Matroska Specifications有很好的解释。

DocTypeVersion MUST be equal to or greater than the highest Matroska version number of any Element present in the Matroska file. For example, a file using the SimpleBlock Element MUST have a DocTypeVersion equal to or greater than 2. A file containing CueRelativePosition Elements MUST have a DocTypeVersion 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 only Elements of version 2 or lower except for CueRelativePosition (which is a version 4 Matroska Element), then DocTypeReadVersion SHOULD still be set to 2 and not 4 because evaluating CueRelativePosition is not necessary for standard playback -- it makes seeking more precise if used.

此外,SimpleBlock Elements 是包含实际视频或音频数据的版本 2 Elements,这就是为什么 DocTypeReadVersion 如果使用的话应该是 2 - 它们有实际的文件内容!因此,不支持版本 2 的播放器将无法播放 Elements.

中的内容