html5 视频标签编解码器属性

标签 html video

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

<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 是什么意思?

干杯 托比

最佳答案

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

对于avc1.4D401Eavc1表示H.264视频,后面跟着一个点和三个由the H.264 standard定义的2位十六进制数:

  1. profile_idc
  2. 包含 constraint_set 标志的字节(当前为 constraint_set0_flagconstraint_set5_flag,以及 reserved_zero_2bits)
  3. level_idc

一些例子:

  • avc1.42E01E:H.264 Constrained Baseline Profile Level 3
  • avc1.4D401E:H.264 Main Profile Level 3
  • avc1.64001E:H.264 High Profile Level 3

这些也是 MP4 文件中 Sequence Parameter Set 和 AVC Configuration Box 的第二个、第三个和第四个字节。您可以使用诸如 mp4file 之类的程序转储这些字节:mp4file --dump movie.mp4。查找 avcC(AVC 配置)框和 AVCProfileIndicationprofile_compatibilityAVCLevelIndication 的十六进制值。

对于mp4a.40.2mp4a表示MPEG-4音频。它后面跟着一个点和一个十六进制的 ObjectTypeIndication(mp4file 输出中的 objectTypeId),可以在 the MPEG4 registration site 上查找。如果此十六进制值为 40(ISO/IEC 14496-3 音频),则其后跟另一个点和十进制的音频对象类型。这些列在 ISO/IEC 14496-3 标准和 Wikipedia 上,对应于 DecoderSpecificInfo (decSpecificInfo) 的前 5 位(除非这些位等于 31,在这种情况下,将 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)
...

关于html5 视频标签编解码器属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16363167/

相关文章:

python - 在 Jenkins 中发送电子邮件时添加 png 图像和表格 html

html - 我的应用程序中字符之间没有空格

javascript - 如何在网页中包含日历

java - 从 Java 数据库中流式传输视频

javascript - Media Source Api 不适用于自定义 webm 文件(Chrome 版本 23.0.1271.97 m)

html - 使视频匹配其父容器的大小(使用 vh 和 vw 单位)

html - 带有图标的 Bootstrap 图像悬停叠加

html - 如何获取 GIF "out of sync"

android - 在 Android 上将视频转码/转换为 Mp4

video - 使用 FFMPEG 将 RTSP 流式传输到 HLS 流,使用较新的 FFMPEG 时出现错误