如何根据 FFMpeg 编码命令或输出确定 AV1 文件的正确 HTML5 视频编解码器属性?

How to determine the proper HTML5 video codec attribute for an AV1 file based on the FFMpeg encoding command or output?

我们有一些用 AV1 编码的文件,但我们最近注意到 Chrome 移动设备无法播放这些文件 - 但它不会回退到它可以使用的编码 - 它只是将无法播放的 AV1文件在那里。我希望如果我们添加一个编解码器属性,我们可以解决这个问题 - 但我不确定如何确定这些 AV1 文件的编解码器。

我遇到过 this documentation on MDN,但我不确定如何从中确定正确的编解码器。它开始很简单,但一些值进一步下降,我不知道正确的值是什么。

在 VLC 播放器中打开文件仅显示有关编解码器的非常有限的信息:

MediaInfo的输出是:

General
Complete name                            : demo-av1.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 291 KiB
Duration                                 : 1 min 40 s
Overall bit rate                         : 23.7 kb/s
Writing application                      : Lavf58.43.100

Video
ID                                       : 1
Format                                   : AV1
Format/Info                              : AOMedia Video 1
Format profile                           : High@L3.0
Codec ID                                 : av01
Duration                                 : 1 min 40 s
Bit rate                                 : 22.9 kb/s
Width                                    : 984 pixels
Height                                   : 670 pixels
Display aspect ratio                     : 3:2
Frame rate mode                          : Constant / Constant
Frame rate                               : 24.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:4:4
Bit depth                                : 8 bits
Scan type                                : Progressive / Progressive
Bits/(Pixel*Frame)                       : 0.001
Stream size                              : 281 KiB (96%)
Color range                              : Limited
Codec configuration box                  : av1C / av1C

创建文件的命令和 FFMpeg 的输出如下:


ffmpeg -y -i "D:\RAW VIDEO\Demos\demo.avi" -ss 00:00:00  -c:v libaom-av1 -pix_fmt yuv444p -minrate 500 -b:v 48k -maxrate 1000k -strict experimental -movflags +faststart -f mp4 NUL && ffmpeg -y -i "D:\RAW VIDEO\Demos\demo.avi" -ss 00:00:00  -c:v libaom-av1 -pix_fmt yuv444p -minrate 500 -b:v 48k -maxrate 1000k -strict experimental -movflags +faststart -pass 2 "D:\RAW VIDEO\Demos\converted\demo-av1.mp4"
ffmpeg version git-2020-05-22-38490cb Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200513

  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 46.100 / 56. 46.100
  libavcodec     58. 86.101 / 58. 86.101
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 82.100 /  7. 82.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100

Input #0, avi, from 'D:\RAW VIDEO\Demos\demo.avi':
  Metadata:
    encoder         : Lavf58.29.100
  Duration:
00:00:23.43, start: 0.000000, bitrate: 19719 kb/s
    Stream #0:0: Video: huffyuv (HFYU / 0x55594648), bgr0, 420x240, 19739 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc

Stream mapping:
  Stream #0:0 -> #0:0 (huffyuv (native) -> av1 (libaom-av1))

Press [q] to stop, [?] for help

[libaom-av1 @ 00000000003fb3c0] v1.0.0

Output #0, mp4, to 'NUL':
  Metadata:
    encoder         : Lavf58.43.100

    Stream #0:0: Video: av1 (libaom-av1) (av01 / 0x31307661), yuv444p, 420x240, q=-1--1, 48 kb/s, 30 fps, 15360 tbn, 30 tbc
    Metadata:
      encoder         : Lavc58.86.101 libaom-av1
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A


av01.1.04M.08.0.000.02.02.02.02.0

表示以下组件:av01.P.LLT.DD.M.CCC.cp.tc.mc.F

Component Your video Resulting Value
P Format profile: High@L3.0 1
LLT Format profile: High@L3.0, Main tier 04M
DD Bit depth: 8 bits 08
M Not monochrome (its not black & white) 0
CCC Chroma subsampling: YUV 4:4:4 000
cp unknown 02
tc unknown 02
mc unknown 02
F Color range: Limited 0
  • The "codecs" parameter in common media types: AV1 将 link 提供有用的值表的 AV1 规范的相应部分。

  • mediainfoffprobe 会告诉您 cp(颜色原色)、tc(传输特性)和 mc(矩阵系数)不是未知数。由于这些未在您的 mediainfo 输出中列出,并且您没有使用相关的编码选项(-colorspace-color_trc-color_primaries),因此该值未知。