1

我对此几乎失去了理智,我确定我错过了一些简单的东西。

我有两个由 OBS 生成的 *.mkv 文件。更好的是,我刚刚将一个文件复制了两次,所以我确信我有相同的比特率、fps、tbn 等等。

然后我做:

ffmepg -i "concat:file1.mkv|file1_copy.mkv" -c copy test.mkv

它运行,我的屏幕充满了黄色消息:

    ffmpeg -i "concat:file1.mkv|file1_copy.mkv" -c copy test.mkv
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --disable-static --enable-shared --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. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, matroska,webm, from 'concat:file1.mkv|file1_copy.mkv':
  Metadata:
    ENCODER         : Lavf58.20.100
  Duration: 00:00:09.15, start: 0.000000, bitrate: 2006 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      DURATION        : 00:00:09.150000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : simple_aac_recording
      DURATION        : 00:00:09.102000000
Output #0, matroska, to 'test.mkv':
  Metadata:
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 60 fps, 60 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      DURATION        : 00:00:09.150000000
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : simple_aac_recording
      DURATION        : 00:00:09.102000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[matroska,webm @ 00000156ce7f14c0] File extends beyond end of segment.
[matroska @ 00000156cef62040] Non-monotonous DTS in output stream 0:0; previous: 9100, current: 0; changing to 9100. This may result in incorrect timestamps in the output file.
[matroska @ 00000156cef62040] Non-monotonous DTS in output stream 0:0; previous: 9100, current: 67; changing to 9100. This may result in incorrect timestamps in the output file.
[matroska @ 00000156cef62040] Non-monotonous DTS in output stream 0:0; previous: 9100, current: 33; changing to 9100. This may result in incorrect timestamps in the output file.
[matroska @ 00000156cef62040] Non-monotonous DTS in output stream 0:1; previous: 9102, current: 0; changing to 9102. This may result in incorrect timestamps in the output file.
[matroska @ 00000156cef62040] Non-monotonous DTS in output stream 0:0; previous: 9100, current: 17; changing to 9100. This may result in incorrect timestamps in the output file.

############## thousands of the above lines here #####################

frame= 1098 fps=0.0 q=-1.0 Lsize=    2241kB time=00:00:09.11 bitrate=2013.0kbits/s speed=24.9x
video:2068kB audio:159kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.607770%

打开时,时间戳只会到第一段的末尾,即使视频在之后继续播放。通常这会很好,但我正在录制教学视频,用户能够跳过它们会很好。即使我重新编码视频(我不应该需要,因为它们是相同的)或重新编码输出,也会发生这种情况。

我在网上阅读的所有内容都说:

  • 重新编码*到 .mkv 来解决这个问题,因为 .mkv 有一个固定的 tbn - 它已经是 .mkv

  • 问题是不同的比特率/tbs/fps/whatever - 现在,它们是相同的视频两次

  • 使用-fflags +genpts, -use_wallclock_as_timestamps 1, vsync 0 -enc_time_base -1- 据我所知,这些都没有做任何事情,无论是之前-i还是之后-c copy

我已经没有想法了。我究竟做错了什么。

4

0 回答 0