使用 FFMPEG 连接 GoPro 视频

使用 FFMPEG 连接 GoPro 视频

我有几个 60 fps 的 GoPro 录像,我想将它们连接起来。ffmpeg -analyzeduration 2147483647 -probesize 2147483647 -f concat -safe 0 -i concat_list.txt -c copy out.MP4连接 GoPro 视频的正确命令是什么?concat_list.txt 包含 GoPro 视频文件 (mp4) 的列表。我之所以问这个问题,是因为连接后的视频比所有单个视频时长的总和长 2 秒。当我运行命令时,输出如下所示(我在 Win 7 上运行它):

ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --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
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000004ee340] Auto-inserting h264_mp4toannexb bitstream filter
[concat @ 00000000004e2cc0] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, concat, from 'U:\GoPro_concat\concat_video.txt':
  Duration: N/A, start: 0.000000, bitrate: 15110 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 14982 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc
    Metadata:
      creation_time   : 2019-04-16T13:18:14.000000Z
      handler_name    :  GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 13:17:26:44
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
    Metadata:
      creation_time   : 2019-04-16T13:18:14.000000Z
      handler_name    :  GoPro AAC
      timecode        : 13:17:26:44
    Stream #0:2: Unknown: none
Output #0, mp4, to 'U:\GoPro_concat\GoPro_concat.MP4':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 14982 kb/s, 0.02 fps, 59.94 tbr, 60k tbn, 60k tbc
    Metadata:
      creation_time   : 2019-04-16T13:18:14.000000Z
      handler_name    :  GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 13:17:26:44
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s
    Metadata:
      creation_time   : 2019-04-16T13:18:14.000000Z
      handler_name    :  GoPro AAC
      timecode        : 13:17:26:44
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000066703980] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000066703980] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000005b440c0] Auto-inserting h264_mp4toannexb bitstream filter
frame=268936 fps=1647 q=-1.0 Lsize= 8282945kB time=01:14:46.73 bitrate=15123.2kbits/s speed=27.5x    
video:8205691kB audio:70105kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.086390%

在一个原始文件上运行ffmpeg -i会产生以下输出:

ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/102GOPRO/GOPR0333.MP4':
  Metadata:
    major_brand     : avc1
    minor_version   : 0
    compatible_brands: avc1isom
    creation_time   : 2019-04-16 13:18:14
  Duration: 00:19:53.73, start: 0.000000, bitrate: 15122 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1280x720 [SAR 1:1 DAR 16:9], 14982 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
      creation_time   : 2019-04-16 13:18:14
      handler_name    :  GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 13:17:26:44
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2019-04-16 13:18:14
      handler_name    :  GoPro AAC
      timecode        : 13:17:26:44
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-04-16 13:18:14
      timecode        : 13:17:26:44

答案1

由于各个音轨的时间戳不同,持续时间差异可能是错误的整体估计。如果您在各个视频的边界处没有看到任何故障,那么应该没问题。

关于“MP4 到附件 B”过滤器的信息不是一个警告;您可以忽略它。

最后,似乎原始文件中有一个时间码轨道在连接视频时会丢失。如果您不打算使用该时间码做任何事情,这不是问题。如果您想同步同一事件的多个 GoPro 录制内容,该时间码可能会有用。

相关内容