我正在尝试使用 ffmpeg 中的分段将单个输入文件拆分为 4 个单独的输出文件。我正在将流复制到单独的输出文件(输入使用 DNxHD 编解码器,因此不存在关键帧问题)。
命令:
ffmpeg -i input.mov -c copy -r 24 -reset_timestamps 1 -map 0:0 -f segment -increment_tc 1 -segment_start_number 1 -segment_frames 360,720,1080 output_%4d.mov
到目前为止,该命令运行良好,除了时间码。输出文件中没有数据/时间码流,我在处理过程中看到每个片段都出现此错误...
必须指定有效的时间码帧速率。最小值为 1
完整输出:
ffmpeg -i input.mov -c copy -r 24 -reset_timestamps 1 -map 0:0 -f segment -increment_tc 1 -segment_start_number 1 -segment_frames 360,720,1080 output_%4d.mov
ffmpeg version N-94014-g80e68ce116-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 28.100 / 56. 28.100
libavcodec 58. 52.102 / 58. 52.102
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 55.100 / 7. 55.100
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2019-06-14T13:48:53.000000Z
timecode : 01:00:00:00
Duration: 00:01:00.00, start: 0.000000, bitrate: 116392 kb/s
Stream #0:0(eng): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt709), 1920x1080, 116391 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24k tbn, 24k tbc (default)
Metadata:
creation_time : 2019-06-14T13:48:53.000000Z
handler_name : Apple Video Media Handler
encoder : Avid DNxHD Codec
Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-06-14T13:49:09.000000Z
handler_name : Time Code Media Handler
timecode : 01:00:00:00
[segment @ 0x7fa448001600] Opening 'output_0001.mov' for writing
[mov @ 0x7fa448003400] Valid timecode frame rate must be specified. Minimum value is 1
Output #0, segment, to 'output_%4d.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
timecode : 01:00:00:00
encoder : Lavf58.27.103
Stream #0:0(eng): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 116391 kb/s, 24 fps, 24 tbr, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2019-06-14T13:48:53.000000Z
handler_name : Apple Video Media Handler
encoder : Avid DNxHD Codec
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[segment @ 0x7fa448001600] Opening 'output_0002.mov' for writing
[mov @ 0x7fa449000000] Valid timecode frame rate must be specified. Minimum value is 1
[segment @ 0x7fa448001600] Opening 'output_0003.mov' for writing
[mov @ 0x7fa449000000] Valid timecode frame rate must be specified. Minimum value is 1
[segment @ 0x7fa448001600] Opening 'output_0004.mov' for writing speed=73.7x
[mov @ 0x7fa449800c00] Valid timecode frame rate must be specified. Minimum value is 1
frame= 1440 fps=0.0 q=-1.0 Lsize=N/A time=00:00:59.95 bitrate=N/A speed=72.7x
video:852480kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
在启用完整调试的情况下查看命令,错误显示:
[mov @ 0x7f9d4a006800] timecode: tbc=1/0 invalid, fallback on 0/0
[mov @ 0x7f9d4a006800] Valid timecode frame rate must be specified. Minimum value is 1
我不知道有什么方法可以在 drawtext 过滤器之外将时间码帧速率设置为选项,这显然是不相关的。查看此错误原始源代码,它似乎是专门为处理 drawtext 过滤器中的问题而设计的,如本文所述错误报告。
首先,命令格式是否正确?其次,有没有办法保留输入的时间码轨道并使用“-increment_tc 1”标志来确保每个片段都正确设置?顺便说一句,我也尝试添加“-timecode 00:00:00:00”来查看是否可以创建新轨道,但这没有任何作用。
谢谢
编辑... 以下是使用“-map 0”而不是“-map 0:0”时显示错误的日志
ffmpeg -i input.mov -c copy -r 24 -reset_timestamps 1 -map 0 -f segment -increment_tc 1 -segment_start_number 1 -segment_frames 360,720,1080 output_%4d.mov
ffmpeg version N-94014-g80e68ce116-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2000-2019 the FFmpeg developers
built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 28.100 / 56. 28.100
libavcodec 58. 52.102 / 58. 52.102
libavformat 58. 27.103 / 58. 27.103
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 55.100 / 7. 55.100
libswscale 5. 4.101 / 5. 4.101
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2019-06-14T13:48:53.000000Z
timecode : 01:00:00:00
Duration: 00:01:00.00, start: 0.000000, bitrate: 116392 kb/s
Stream #0:0(eng): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt709), 1920x1080, 116391 kb/s, SAR 1:1 DAR 16:9, 24 fps, 24 tbr, 24k tbn, 24k tbc (default)
Metadata:
creation_time : 2019-06-14T13:48:53.000000Z
handler_name : Apple Video Media Handler
encoder : Avid DNxHD Codec
Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-06-14T13:49:09.000000Z
handler_name : Time Code Media Handler
timecode : 01:00:00:00
[segment @ 0x7fe5d5807400] Opening 'output_0001.mov' for writing
[mov @ 0x7fe5d5802a00] Valid timecode frame rate must be specified. Minimum value is 1
Output #0, segment, to 'output_%4d.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
timecode : 01:00:00:00
encoder : Lavf58.27.103
Stream #0:0(eng): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 116391 kb/s, 24 fps, 24 tbr, 12288 tbn, 24 tbc (default)
Metadata:
creation_time : 2019-06-14T13:48:53.000000Z
handler_name : Apple Video Media Handler
encoder : Avid DNxHD Codec
Stream #0:1(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2019-06-14T13:49:09.000000Z
handler_name : Time Code Media Handler
timecode : 01:00:00:00
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Floating point exception: 8
答案1
为了用答案来完成这篇文章,这个问题是由 ffmpeg 中的一些错误引起的,现在 Gyan 已经修复了这些错误: