[FFmpeg-user] Question on Segment TImes

Colin Bitterfield colin at bitterfield.com
Sat Apr 4 09:29:07 EEST 2020


I am trying to segment split a stream coming in from AVFOUNDATION

ffmpeg -benchmark_all -stats -loglevel debug -copyts \
 -f avfoundation -capture_raw_data true -pix_fmt 0rgb -i DV-VCR -q 0 \
 -map 0 -c:v copy -c:a copy -segment_time 00:00:10 \
 -f segment  374_%03d.dv -y

_ I have tried various combinations of “-increment_tc” and "-reset_timestamps 0"

The video splits flawless at the time requested and this has solved a lot of size issues. It would help if the time stamps did not reset to zero each time.


Splitting the commandline.
Reading option '-benchmark_all' ... matched as option 'benchmark_all' (add timings for each task) with argument ‘1’.
Reading option '-stats' ... matched as option 'stats' (print progress report during encoding) with argument ‘1’.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument ‘debug’.
Reading option '-copyts' ... matched as option 'copyts' (copy timestamps) with argument ‘1’.
Reading option '-f' ... matched as option 'f' (force format) with argument ‘avfoundation’.
Reading option '-capture_raw_data' ... matched as AVOption 'capture_raw_data' with argument ‘true’.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument ‘0rgb’.
Reading option '-i' ... matched as input url with argument 'DV-VCR’.
Reading option '-q' ... matched as option 'q' (use fixed quality scale (VBR)) with argument ‘0’.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument ‘0’.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument ‘copy’.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument ‘copy’.
Reading option '-segment_time' ... matched as AVOption 'segment_time' with argument '00:00:10’.
Reading option '-f' ... matched as option 'f' (force format) with argument ‘segment’.
Reading option '374_%03d.dv' ... matched as output url.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument ‘1’.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option benchmark_all (add timings for each task) with argument 1.
Applying option stats (print progress report during encoding) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Applying option copyts (copy timestamps) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url DV-VCR.
Applying option f (force format) with argument avfoundation.
Applying option pix_fmt (set pixel format) with argument 0rgb.
Successfully parsed a group of options.
Opening an input file: DV-VCR.
[avfoundation @ 0x7fc8ee008200] 'DV-VCR’ opened
[avfoundation @ 0x7fc8ee008200] Selected framerate (29.970030) is not supported by the device.
[avfoundation @ 0x7fc8ee008200] Falling back to default.

— It looks like it is working
segment @ 0x7fc8ef809600] stream:0 start_pts_time:0 pts:296 pts_time:9.87653 dts:296 dts_time:9.87653 -> pts:296 pts_time:9.87653 dts:296 dts_time:9.87653
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:0 pts:297 pts_time:9.9099 dts:297 dts_time:9.9099 -> pts:297 pts_time:9.9099 dts:297 dts_time:9.9099
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:0 pts:298 pts_time:9.94327 dts:298 dts_time:9.94327 -> pts:298 pts_time:9.94327 dts:298 dts_time:9.94327
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:0 pts:299 pts_time:9.97663 dts:299 dts_time:9.97663 -> pts:299 pts_time:9.97663 dts:299 dts_time:9.97663
[segment @ 0x7fc8ef809600] segment:'374_000.dv' count:0 ended
[AVIOContext @ 0x7fc8eda07a00] Statistics: 0 seeks, 136 writeouts
[segment @ 0x7fc8ef809600] Opening '374_001.dv' for writing
[file @ 0x7fc8eb65e500] Setting default whitelist 'file,crypto’
[segment @ 0x7fc8ef809600] segment:'374_001.dv' starts with packet stream:0 pts:300 pts_time:10.01 frame:296
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:10.01 pts:300 pts_time:10.01 dts:300 dts_time:10.01 -> pts:300 pts_time:10.01 dts:300 dts_time:10.01
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:10.01 pts:301 pts_time:10.0434 dts:301 dts_time:10.0434 -> pts:301 pts_time:10.0434 dts:301 dts_time:10.0434
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:10.01 pts:302 pts_time:10.0767 dts:302 dts_time:10.0767 -> pts:302 pts_time:10.0767 dts:302 dts_time:10.0767
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:10.01 pts:303 pts_time:10.1101 dts:303 dts_time:10.1101 -> pts:303 pts_time:10.1101 dts:303 dts_time:10.1101
[segment @ 0x7fc8ef809600] stream:0 start_pts_time:10.01 pts:304 pts_time:10.1435 dts:304 dts_time:10.1435 -> pts:304 pts_time:10.1435 dts:304 dts_time:10.1435

However, the video still starts at Zero:

Input #0, dv, from '374_001.dv’:
  Metadata:
    timecode : 00:00:00:00
  Duration: 00:00:01.63, start: 0.000000, bitrate: 28771 kb/s
    Stream #0:0: Video: dvvideo, yuv411p, 720x480 [SAR 8:9 DAR 4:3], 25000 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[FORMAT]
filename=374_001.dv
nb_streams=2
nb_programs=0
format_name=dv
format_long_name=DV (Digital Video)
start_time=0:00:00.000000
duration=0:00:01.634967
size=5880000
bit_rate=28771222
probe_score=75
TAG:timecode=00:00:00:00
[/FORMAT]


More information about the ffmpeg-user mailing list