带有 -pre 标志的 FFmpeg 可能的错误

FFmpeg possible bug with -pre flag

我正在研究 ffpresets 和 avpresets,但我偶然发现了一些有趣的东西。

根据 ffmpeg docs:

First ffmpeg searches for a file named codec_name-arg.avpreset in the above-mentioned directories, where codec_name is the name of the codec to which the preset file options will be applied. For example, if you select the video codec with -vcodec libvpx and use -pre 1080p, then it will search for the file libvpx-1080p.avpreset.

If no such file is found, then ffmpeg will search for a file named arg.avpreset in the same directories.

我有一个预设存储在正确的目录中:

$ ls ~/.avconv/
libvpx-1080p.avpreset

因此,以下命令应该有效:

$ ffmpeg -i input.mp4 -vcodec libvpx -pre 1080p output.mp4 

但它会导致以下错误:

Preset 1080p specified for stream 0:1, but could not be opened.

但是,以下命令有效:

ffmpeg -i input.mp4 -vcodec libvpx -pre libvpx-1080p output.mp4

这是错误还是我误解了文档?

编辑:我最初尝试使用存储库 (4.3.1) 提供的最新 ffmpeg 版本。然而,我随后决定确认从 source 构建的最新版本仍然是这种情况,结果是:

~/Downloads/FFmpeg$ ./ffmpeg --version
ffmpeg version N-102649-g3ac7d99428 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)
configuration: --disable-x86asm --enable-libvpx
libavutil      57.  0.100 / 57.  0.100
libavcodec     59.  1.100 / 59.  1.100
libavformat    59.  2.101 / 59.  2.101
libavdevice    59.  0.100 / 59.  0.100
libavfilter     8.  0.101 /  8.  0.101
libswscale      6.  0.100 /  6.  0.100
libswresample   4.  0.100 /  4.  0.100

编辑 2:按要求添加失败命令的整个日志

$ ./ffmpeg -i ../input.mp4 -vcodec libvpx -pre 1080p ../output.mp4
ffmpeg version N-102649-g3ac7d99428 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10 (Ubuntu 10.2.0-13ubuntu1)
  configuration: --disable-x86asm --enable-libvpx
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  2.101 / 59.  2.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../input.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomavc1
    creation_time   : 2015-08-07T09:13:36.000000Z
  Duration: 00:00:30.53, start: 0.000000, bitrate: 4675 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4486 kb/s, 30 fps, 30 tbr, 30 tbn (default)
    Metadata:
      creation_time   : 2015-08-07T09:13:36.000000Z
      handler_name    : L-SMASH Video Handler
      vendor_id       : [0][0][0][0]
      encoder         : AVC Coding
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      creation_time   : 2015-08-07T09:13:36.000000Z
      handler_name    : L-SMASH Audio Handler
      vendor_id       : [0][0][0][0]
Preset 1080p specified for stream 0:1, but could not be opened.

-pre 选项接受流说明符,在没有任何说明符的情况下,将应用于所有流。由于 MP4 的默认音频编码器是 aac,ffmpeg 将寻找 aac-1080p.avpreset 然后 1080p.avpreset 因为这两个都不存在,所以 ffmpeg 会出错。

-pre 更改为 -vpre-pre:v