ffmpeg increases video segments length when used with -segment_time - how to fix?

2

I am trying to record rtmp stream to file, splitting every 10 seconds.

My ffmpeg command is:

ffmpeg -i rtmp://192.168.16.82:1935 -f segment -strftime 1 -segment_time 10 -segment_format avi E:\record\CAM1_%Y-%m-%d_%H-%M-%S.avi

It works, but the created files are getting corrupted in some way. First file is OK, length is 10 sec; second file's length is 20 sec, and first 10 seconds is the static image; third file is 30 sec, and first 20 seconds are nothing but static image, and so on.

What I'm doing wrong?

a1mighty

Posted 2016-04-15T05:54:55.937

Reputation: 23

Answers

2

AVI doesn't work with PTS, so you'll have to reset timestamps:

ffmpeg -i rtmp://192.168.16.82:1935 -f segment -strftime 1 -reset_timestamps 1 -segment_time 10 -segment_format avi E:\record\CAM1_%Y-%m-%d_%H-%M-%S.avi

Gyan

Posted 2016-04-15T05:54:55.937

Reputation: 21 016