尝试对 mkv 文件执行任何操作时,ffmpeg “父级中的长度无效 0x59f0 > 0x8bd7fe90”

尝试对 mkv 文件执行任何操作时,ffmpeg “父级中的长度无效 0x59f0 > 0x8bd7fe90”

我觉得在一两个月前我从未遇到过这个问题。起初我以为我输入了错误的命令或输入了损坏的文件,但我尝试过的每个 mkv 文件(来自不同的来源)都会发生这种情况。示例:

PS O:\video_editing\ff> ffmpeg -i '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C].mkv'
ffmpeg version N-93286-g4635f64953 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.102 / 58. 47.102
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, matroska,webm, from '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C].mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-02-18T09:08:01.000000Z
  Duration: 00:26:30.98, start: 0.000000, bitrate: 11797 kb/s
    Chapter #0:0: start 0.000000, end 569.567000
    Metadata:
      title           :
    Chapter #0:1: start 569.567000, end 1246.452000
    Metadata:
      title           :
    Chapter #0:2: start 1246.452000, end 1590.976000
    Metadata:
      title           :
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1064, SAR 1:1 DAR 240:133, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS             : 11571497
      BPS-eng         : 11571497
      DURATION        : 00:26:30.965000000
      DURATION-eng    : 00:26:30.965000000
      NUMBER_OF_FRAMES: 38145
      NUMBER_OF_FRAMES-eng: 38145
      NUMBER_OF_BYTES : 2301230881
      NUMBER_OF_BYTES-eng: 2301230881
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default)
    Metadata:
      title           : English AC3 224 kbps
      BPS             : 224000
      BPS-eng         : 224000
      DURATION        : 00:26:30.976000000
      DURATION-eng    : 00:26:30.976000000
      NUMBER_OF_FRAMES: 49718
      NUMBER_OF_FRAMES-eng: 49718
      NUMBER_OF_BYTES : 44547328
      NUMBER_OF_BYTES-eng: 44547328
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      title           : English SDH
      BPS             : 54
      BPS-eng         : 54
      DURATION        : 00:25:29.694000000
      DURATION-eng    : 00:25:29.694000000
      NUMBER_OF_FRAMES: 309
      NUMBER_OF_FRAMES-eng: 309
      NUMBER_OF_BYTES : 10462
      NUMBER_OF_BYTES-eng: 10462
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(pol): Subtitle: subrip
    Metadata:
      title           : Polish
      BPS             : 49
      BPS-eng         : 49
      DURATION        : 00:26:06.772000000
      DURATION-eng    : 00:26:06.772000000
      NUMBER_OF_FRAMES: 297
      NUMBER_OF_FRAMES-eng: 297
      NUMBER_OF_BYTES : 9701
      NUMBER_OF_BYTES-eng: 9701
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
At least one output file must be specified
PS O:\video_editing\ff> ffmpeg -i '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C].mkv' -c copy '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C]_copy.mkv'
ffmpeg version N-93286-g4635f64953 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 47.102 / 58. 47.102
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, matroska,webm, from '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C].mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-02-18T09:08:01.000000Z
  Duration: 00:26:30.98, start: 0.000000, bitrate: 11797 kb/s
    Chapter #0:0: start 0.000000, end 569.567000
    Metadata:
      title           :
    Chapter #0:1: start 569.567000, end 1246.452000
    Metadata:
      title           :
    Chapter #0:2: start 1246.452000, end 1590.976000
    Metadata:
      title           :
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1064, SAR 1:1 DAR 240:133, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      BPS             : 11571497
      BPS-eng         : 11571497
      DURATION        : 00:26:30.965000000
      DURATION-eng    : 00:26:30.965000000
      NUMBER_OF_FRAMES: 38145
      NUMBER_OF_FRAMES-eng: 38145
      NUMBER_OF_BYTES : 2301230881
      NUMBER_OF_BYTES-eng: 2301230881
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default)
    Metadata:
      title           : English AC3 224 kbps
      BPS             : 224000
      BPS-eng         : 224000
      DURATION        : 00:26:30.976000000
      DURATION-eng    : 00:26:30.976000000
      NUMBER_OF_FRAMES: 49718
      NUMBER_OF_FRAMES-eng: 49718
      NUMBER_OF_BYTES : 44547328
      NUMBER_OF_BYTES-eng: 44547328
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      title           : English SDH
      BPS             : 54
      BPS-eng         : 54
      DURATION        : 00:25:29.694000000
      DURATION-eng    : 00:25:29.694000000
      NUMBER_OF_FRAMES: 309
      NUMBER_OF_FRAMES-eng: 309
      NUMBER_OF_BYTES : 10462
      NUMBER_OF_BYTES-eng: 10462
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:3(pol): Subtitle: subrip
    Metadata:
      title           : Polish
      BPS             : 49
      BPS-eng         : 49
      DURATION        : 00:26:06.772000000
      DURATION-eng    : 00:26:06.772000000
      NUMBER_OF_FRAMES: 297
      NUMBER_OF_FRAMES-eng: 297
      NUMBER_OF_BYTES : 9701
      NUMBER_OF_BYTES-eng: 9701
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Output #0, matroska, to '.\Six Shooter (2004) 1080p.bluray.x264-hd4u[N1C]_copy.mkv':
  Metadata:
    encoder         : Lavf58.26.101
    Chapter #0:0: start 0.000000, end 569.567000
    Metadata:
      title           :
    Chapter #0:1: start 569.567000, end 1246.452000
    Metadata:
      title           :
    Chapter #0:2: start 1246.452000, end 1590.976000
    Metadata:
      title           :
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1064 [SAR 1:1 DAR 240:133], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      BPS             : 11571497
      BPS-eng         : 11571497
      DURATION        : 00:26:30.965000000
      DURATION-eng    : 00:26:30.965000000
      NUMBER_OF_FRAMES: 38145
      NUMBER_OF_FRAMES-eng: 38145
      NUMBER_OF_BYTES : 2301230881
      NUMBER_OF_BYTES-eng: 2301230881
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1(eng): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 224 kb/s (default)
    Metadata:
      title           : English AC3 224 kbps
      BPS             : 224000
      BPS-eng         : 224000
      DURATION        : 00:26:30.976000000
      DURATION-eng    : 00:26:30.976000000
      NUMBER_OF_FRAMES: 49718
      NUMBER_OF_FRAMES-eng: 49718
      NUMBER_OF_BYTES : 44547328
      NUMBER_OF_BYTES-eng: 44547328
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:2(eng): Subtitle: subrip
    Metadata:
      title           : English SDH
      BPS             : 54
      BPS-eng         : 54
      DURATION        : 00:25:29.694000000
      DURATION-eng    : 00:25:29.694000000
      NUMBER_OF_FRAMES: 309
      NUMBER_OF_FRAMES-eng: 309
      NUMBER_OF_BYTES : 10462
      NUMBER_OF_BYTES-eng: 10462
      _STATISTICS_WRITING_APP: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v20.0.0 ('I Am The Sun') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-02-18 09:08:01
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-02-18 09:08:01
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame= 3162 fps=0.0 q=-1.0 size=  129560kB time=00:02:11.96 bitrate=8042.5kbits/s speed= 26frame= 5609 fps=5604 q=-1.0 size=  266189kB time=00:03:54.11 bitrate=9314.4kbits/s speed= 2frame= 7606 fps=5060 q=-1.0 size=  398518kB time=00:05:17.34 bitrate=10287.4kbits/s speed= frame= 9716 fps=4841 q=-1.0 size=  531397kB time=00:06:45.37 bitrate=10738.7kbits/s speed= frame=12088 fps=4805 q=-1.0 size=  665217kB time=00:08:24.19 bitrate=10808.3kbits/s speed=2frame=14237 fps=4721 q=-1.0 size=  795989kB time=00:09:53.72 bitrate=10982.7kbits/s speed= frame=16151 fps=4590 q=-1.0 size=  921736kB time=00:11:13.76 bitrate=11207.0kbits/s speed= frame=18371 fps=4571 q=-1.0 size= 1050391kB time=00:12:46.30 bitrate=11229.0kbits/s speed= frame=19822 fps=4357 q=-1.0 size= 1167313kB time=00:13:46.78 bitrate=11566.1kbits/s speed= frame=22293 fps=4414 q=-1.0 size= 1305211kB time=00:15:29.82 bitrate=11499.3kbits/s speed= frame=24584 fps=4422 q=-1.0 size= 1461000kB time=00:17:05.50 bitrate=11670.9kbits/s speed= frame=26677 fps=4391 q=-1.0 size= 1617073kB time=00:18:32.73 bitrate=11904.9kbits/s speed= frame=28500 fps=4332 q=-1.0 size= 1760880kB time=00:19:48.76 bitrate=12134.5kbits/s speed= frame=30490 fps=4305 q=-1.0 size= 1902637kB time=00:21:11.80 bitrate=12255.3kbits/s speed= frame=33042 fps=4358 q=-1.0 size= 2047984kB time=00:22:58.20 bitrate=12173.1kbits/s speed= frame=35874 fps=4429 q=-1.0 size= 2203686kB time=00:24:56.38 bitrate=12064.1kbits/s speed= [matroska,webm @ 000001bef8528a80] Invalid length 0x59f0 > 0x8bd7fe90 in parent
frame=38145 fps=4541 q=-1.0 Lsize= 2291479kB time=00:26:30.94 bitrate=11799.2kbits/s speed= 189x
video:2247296kB audio:43503kB subtitle:10kB other streams:0kB global headers:0kB muxing overhead: 0.029226%

它不仅似乎在不应该重新编码时开始重新编码,还在最后给出标题中的错误,并且生成的文件大小也不同。现在只是复制。相同的容器,相同的一切。当我尝试重新映射流、重新编码音轨或更改容器时,情况变得更糟。我不知道是最近的 ffmpeg 版本有这个错误还是我的 Windows 安装放弃了。正如我所说,就在几个月前一切都正常。

还值得注意的是,mp4 文件也能正常工作。

答案1

我今天也遇到了同样的问题。我可以通过mkclean以下方式解决这个问题:https://www.matroska.org/downloads/mkclean.html

这是 Matroska(负责 mkv 容器格式的开发小组)提供的命令行工具。我只需运行以下命令即可修复我的文件./mkclean <input video file.mkv> <output video file.mkv>

我可以确认,旧版本的 ffmpeg 似乎不会遇到此问题。在另一台机器上,我有一个旧版本的 ffmpeg(3.4.2,在 Mac OS 上使用 homebrew 编译),它可以很好地处理 mkv 文件。同样出于好奇,我使用默认配置从最新源代码构建了 ffmpeg,它也给了我“父级中无效长度 0x15d6 > 0xfa3525f”错误。

相关内容