I'm attempting to break down a single input file into 4 separate output files using segment in ffmpeg. I'm stream copying to the separate output files (the input uses the DNxHD codec, so there are no keyframe issues).
Command:
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
So far the command is working well, except for timecode. There is no data / timecode stream in the output files and I'm seeing this error for each segment during processing...
Valid timecode frame rate must be specified. Minimum value is 1
Full output:
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
Looking at the command with full debug on, the error shows:
[mov @ 0x7f9d4a006800] timecode: tbc=1/0 invalid, fallback on 0/0
[mov @ 0x7f9d4a006800] Valid timecode frame rate must be specified. Minimum value is 1
I'm not aware of any way to set the timecode framerate as an option outside of the drawtext filter, which obviously is not relevant. Looking at this error in the original source code, it appears it's specifically designed to handle issues within the drawtext filter as referenced in this bug report.
Firstly, is the command formatted correctly and secondly, is there a way to preserve the input timecode track and using the '-increment_tc 1' flag to keep it correctly set for each segment? BTW I have also tried adding '-timecode 00:00:00:00' to see if I could create a new track, but this did nothing.
Thanks
edit... Here is the log to show the error when using '-map 0' instead of '-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
Floating point exception: 8
and the command stops without creating the output files.