将 mkv 转换为 mp4 时出现 ffmpeg 错误

ffmpeg errors from converting mkv to mp4

我一直在使用ffmpeg将mkv转mp4,下面是我使用的命令。

ffmpeg -i demo.mkv -vcodec libx264 -vprofile high -crf 28 -c:v h264 demo.mp4

但是现在我在尝试转换新的 mkv 文件时遇到错误。我在网上做了相当广泛的搜索,但到目前为止我还没有找到解决方案。

以下是屏幕输出,其中包括版本和库信息。

ffmpeg version N-101385-gb34d1de Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
  configuration: --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame --enable-libass
  libavutil      56. 66.100 / 56. 66.100
  libavcodec     58.128.100 / 58.128.100
  libavformat    58. 70.100 / 58. 70.100
  libavdevice    58. 12.100 / 58. 12.100
  libavfilter     7.107.100 /  7.107.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100      libpostproc    55.  8.100 / 55.  8.100
[av1 @ 0x2e66180] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x2e66180] Failed to get pixel format.
[av1 @ 0x2e66180] Missing Sequence Header.
    Last message repeated 122 times    [av1 @ 0x2e66180] video_get_buffer: image parameters invalid
[av1 @ 0x2e66180] get_buffer() failed
[av1 @ 0x2e66180] thread_get_buffer() failed
[av1 @ 0x2e66180] Failed to allocate space for current frame.
[av1 @ 0x2e66180] Get current frame error
[matroska,webm @ 0x2e62580] decoding for stream 0 failed
[matroska,webm @ 0x2e62580] Could not find codec parameters for stream 0 (Video: av1 (Main), none(tv, bt709), 1920x1072 [SAR 1:1 DAR 120:67]): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from 'demo.mkv':
  Metadata:
    COMPATIBLE_BRANDS: iso6av01mp41
    MAJOR_BRAND     : dash
    MINOR_VERSION   : 0
    ENCODER         : Lavf58.70.100
  Duration: 00:13:39.08, start: -0.007000, bitrate: 779 kb/s
  Stream #0:0: Video: av1 (Main), none(tv, bt709), 1920x1072 [SAR 1:1 DAR 12 0:67], 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc.
      VENDOR_ID       : [0][0][0][0]
      DURATION        : 00:13:39.000000000
  Stream #0:1(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
    Metadata:
      DURATION        : 00:13:39.081000000
Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:v h264' will be used.
Stream mapping:
  Stream #0:0 -> #0:0 (av1 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (opus (native) -> aac (native))
Press [q] to stop, [?] for help
[av1 @ 0x2e6ad40] Your platform doesn't suppport hardware accelerated AV1 decoding.
[av1 @ 0x2e6ad40] Failed to get pixel format.
Error while decoding stream #0:0: Function not implemented
[av1 @ 0x2e6ad40] Missing Sequence Header.
Error while decoding stream #0:0: Invalid data found when processing input
... [the above two lines repeated dozens of times]
[av1 @ 0x2e6ad40] video_get_buffer: image parameters invalid
[av1 @ 0x2e6ad40] get_buffer() failed
[av1 @ 0x2e6ad40] thread_get_buffer() failed
[av1 @ 0x2e6ad40] Failed to allocate space for current frame.
[av1 @ 0x2e6ad40] Get current frame error
Error while decoding stream #0:0: Invalid argument
... [the above 6 lines repeated hundreds of times]
[av1 @ 0x2e6ad40] Failed to get reference frame.
Error while decoding stream #0:0: Invalid argument
Cannot determine format of input stream 0:0 after EOF
Error marking filters as finished
[aac @ 0x2ed0f00] Qavg: 3268.314
[aac @ 0x2ed0f00] 2 frames left in the queue on closing
Conversion failed!

请注意,三个点 (...) 表示重复多次的省略行。感谢任何帮助。

您的输入视频流使用 AV1 编解码器,如日志所述,

Your platform doesn't suppport hardware accelerated AV1 decoding.

您将需要一个支持 AV1 解码器的 ffmpeg 构建,例如 libdav1d。在 https://johnvansickle.com/ffmpeg/

有售