html5 视频标签编解码器属性

新手上路,请多包涵

我正在尝试在视频标签中使用指定特定的视频/音频编解码器

<video poster="movie.jpg" controls>
    <source src="movie.mp4" type='video/mp4; codecs="avc1.4D401E, mp4a.40.2"'/>
    <p>This is fallback content</p>
</video>

但找不到正确的编解码器声明来播放视频,我下载了一个视频分析器,可以看到它是一个 avc1,可以看到音频 map.40.2 但可以计算出其余的编解码器,4d401e 是什么意思是在上面?

干杯托比

原文由 user2302694 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.3k
1 个回答

codecs 参数由 RFC 6381 指定。具体的 avc1mp4a 值的含义见 3.3节

avc1.4D401E 的情况下, avc1 表示H.264视频,后面跟着一个点和三个由 H.264标准 定义的2位十六进制数:

  1. profile_idc
  2. the byte containing the constraint_set flags (currently constraint_set0_flag through constraint_set5_flag , and the reserved_zero_2bits )
  3. level_idc

一些例子:

  • avc1.42E01E :H.264 约束基线配置文件级别 3
  • avc1.4D401E : H.264 Main Profile Level 3
  • avc1.64001E : H.264 High Profile Level 3

它们也是 MP4 文件中序列参数集和 AVC 配置框的第二、第三和第四个字节。您可以使用程序转储这些字节,例如 mp4file : mp4file --dump movie.mp4 。 Look for the avcC (AVC Configuration) Box and the hexadecimal values for AVCProfileIndication , profile_compatibility , and AVCLevelIndication .

至于 mp4a.40.2mp4a 表示MPEG-4音频。它后面跟着一个点和一个十六进制 ObjectTypeIndicationobjectTypeId in mp4file 输出),可以在 .MPEG 注册站点 上查找。如果这个十六进制值是 40 (ISO/IEC 14496-3 Audio),它后面跟着另一个点和十进制的音频对象类型。这些列在 ISO/IEC 14496-3 标准和 维基百科 上,对应于 DecoderSpecificInfo ( decSpecificInfo ) 的前 5 位(除非这些位等于 31,其中case 将 32 添加到接下来的 6 位)。 mp4a.40.2 表示AAC LC音频,通常用于H.264 HTML5视频。

例如, codecs="avc1.42E01E, mp4a.40.2" 对于下面的电影来说是正确的:

 $ mp4file --dump movie.mp4
...
    type avcC (moov.trak.mdia.minf.stbl.stsd.avc1.avcC)  ◀━━ avc1
     configurationVersion = 1 (0x01)
     AVCProfileIndication = 66 (0x42)    ◀━━ 42
     profile_compatibility = 224 (0xe0)  ◀━━ E0
     AVCLevelIndication = 30 (0x1e)      ◀━━ 1E
...
    type esds (moov.trak.mdia.minf.stbl.stsd.mp4a.esds)  ◀━━ mp4a
     version = 0 (0x00)
     flags = 0 (0x000000)
     ESID = 2 (0x0002)
     streamDependenceFlag = 0 (0x0) <1 bits>
     URLFlag = 0 (0x0) <1 bits>
     OCRstreamFlag = 0 (0x0) <1 bits>
     streamPriority = 0 (0x00) <5 bits>
     decConfigDescr
      objectTypeId = 64 (0x40)           ◀━━ 40
      streamType = 5 (0x05) <6 bits>
      upStream = 0 (0x0) <1 bits>
      reserved = 1 (0x1) <1 bits>
      bufferSizeDB = 0 (0x000000) <24 bits>
      maxBitrate = 78267 (0x000131bb)
      avgBitrate = 78267 (0x000131bb)
      decSpecificInfo
       info = <2 bytes>  11 90  |..|     ◀━━ 2 (first 5 bits in decimal)
...

原文由 mark4o 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题