我正在尝试连接 GoPro Hero6 分割电影的多个文件以避免 FAT 4GB 限制。 ffmpeg 非常适合此目的,但我需要在元数据流中编码的遥测数据,而 ffmpeg 默认情况下似乎不保留此数据。使用
ffprobe
命令,您可以看到源视频具有:
Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 36 kb/s (default)
Metadata:
creation_time : 2018-07-15T16:16:26.000000Z
handler_name : GoPro MET
我从研究中知道这是我需要的流(尽管我希望能够复制所有流)。然而,当使用
ffmpeg -f concat
时,输出是:
[concat @ 0x7febb9800000] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[concat @ 0x7febb9800000] Could not find codec parameters for stream 3 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[concat @ 0x7febb9800000] Could not find codec parameters for stream 4 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, concat, from 'tmp.txt':
Duration: N/A, start: 0.000000, bitrate: 66194 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 66005 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc
Metadata:
creation_time : 2018-07-15T16:08:22.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 16:23:48:21
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
Metadata:
creation_time : 2018-07-15T16:08:22.000000Z
handler_name : GoPro AAC
timecode : 16:23:48:21
Stream #0:2: Unknown: none
Stream #0:3: Unknown: none
Stream #0:4: Unknown: none
Output #0, mp4, to 'GH0089.MP4':
Metadata:
encoder : Lavf58.12.100
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], q=2-31, 66005 kb/s, 0.02 fps, 59.94 tbr, 60k tbn, 60k tbc
Metadata:
creation_time : 2018-07-15T16:08:22.000000Z
handler_name : GoPro AVC
encoder : GoPro AVC encoder
timecode : 16:23:48:21
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s
Metadata:
creation_time : 2018-07-15T16:08:22.000000Z
handler_name : GoPro AAC
timecode : 16:23:48:21
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
警告
Could not find codec parameters
特别有趣,并且 Stream mapping
显示仅映射视频和音频流。我已经尝试过 map_metadata
但无济于事。我的格式可能不正确,但问题似乎更有可能与警告有关,因为编解码器无法识别,我希望默认情况下映射所有流。
我期望或希望得到一个忽略警告并映射无法识别的流的答案,而不试图理解它们。
如有任何帮助,我们将不胜感激。
最终解决了这个问题……主要是……
ffmpeg \
-y -f concat -i test.txt -c copy \
-map 0:v -map 0:a -map 0:3 \
-copy_unknown -tag:2 gpmd \
test2.mp4
如果遥测数据被标记为 gpmd,似乎 ffmpeg 会理解它......但是无论我做什么,还有另外 2 个流不会映射。看来 ffmpeg 必须能够解析它,并且由于某种原因不能简单地复制这些位。如果您标记它,它可以理解
gpmd
流,但它不能理解其他流之一(fsck
我认为......似乎主要针对硬件,所以无论如何都不重要)。时间码流被标记为 tmcd
,但 GoPro 似乎不遵循此处的标准,因此无法按 1:1 映射...上面的代码产生的结果似乎是最稳定的结果,至少在我尝试过的设置。
可以使用mp4-merge:
使用示例:
mp4_merge IN_FILE1.mp4 IN_FILE2.mp4 IN_FILE3.mp4 ... --out result.mp4
与 FFmpeg 相比,mp4-merge 的优点:与 FFmpeg 不同,mp4-merge 不会反转 GCMD 和 TMCD 流顺序。详情:
使用 FFmpeg 7.1 运行 Andrew 的命令:
ffmpeg -safe 0 -f concat -i list.txt -map 0:v -map 0:a -map 0:3 -copy_unknown -tag:2 gpmd -c copy output.mp4
导致 GCMD 和 TMCD 流顺序颠倒。
例如,之前:
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2022-07-13T08:46:54.000000Z
firmware : H21.01.01.42.00
Duration: 00:00:02.90, start: 0.000000, bitrate: 53612 kb/s
Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 5312x2988 [SAR 1:1 DAR 16:9], 53273 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
Metadata:
creation_time : 2022-07-13T08:46:54.000000Z
handler_name : GoPro H.265
vendor_id : [0][0][0][0]
encoder : GoPro H.265 encoder
timecode : 08:46:23:01
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
creation_time : 2022-07-13T08:46:54.000000Z
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
timecode : 08:46:23:01
Stream #0:2[0x3](eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
Metadata:
creation_time : 2022-07-13T08:46:54.000000Z
handler_name : GoPro TCD
timecode : 08:46:23:01
Stream #0:3[0x4](eng): Data: bin_data (gpmd / 0x646D7067), 55 kb/s (default)
Metadata:
creation_time : 2022-07-13T08:46:54.000000Z
handler_name : GoPro MET
之后:
ffmpeg version 7.1-full_build-www.gyan.dev Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 14.2.0 (Rev1, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libopenjpeg --enable-libquirc --enable-libuavs3d --enable-libxevd --enable-libzvbi --enable-libqrencode --enable-librav1e --enable-libsvtav1 --enable-libvvenc --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxeve --enable-libxvid --enable-libaom --enable-libjxl --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-dxva2 --enable-d3d11va --enable-d3d12va --enable-ffnvcodec --enable-libvpl --enable-nvdec --enable-nvenc --enable-vaapi --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-liblc3 --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 59. 39.100 / 59. 39.100
libavcodec 61. 19.100 / 61. 19.100
libavformat 61. 7.100 / 61. 7.100
libavdevice 61. 3.100 / 61. 3.100
libavfilter 10. 4.100 / 10. 4.100
libswscale 8. 3.100 / 8. 3.100
libswresample 5. 3.100 / 5. 3.100
libpostproc 58. 3.100 / 58. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.MP4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf61.7.100
Duration: 00:00:01.00, start: 0.000000, bitrate: 40941 kb/s
Stream #0:0[0x1](eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, bt709), 5312x2988 [SAR 1:1 DAR 16:9], 40739 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
Metadata:
handler_name : GoPro H.265
vendor_id : [0][0][0][0]
encoder : GoPro H.265 encoder
timecode : 08:46:23:01
Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
Metadata:
handler_name : GoPro AAC
vendor_id : [0][0][0][0]
Stream #0:2[0x3](eng): Data: bin_data (gpmd / 0x646D7067), 54 kb/s (default)
Metadata:
handler_name : GoPro MET
Stream #0:3[0x4](eng): Data: none (tmcd / 0x64636D74), 0 kb/s
Metadata:
handler_name : GoPro H.265
timecode : 08:46:23:01