[FFmpeg-user] Frame rate discrepancy

Marton Balint cus at passwd.hu
Fri Feb 3 23:10:45 EET 2023



On Fri, 3 Feb 2023, Dave Blanchard wrote:

> Hi all, I'm pulling video off a capture card for a surveillance 
> application. I use the -t option to ffmpeg to record a 6 hour segment of 
> video, then stop and start another segment. The problem is the timestamp 
> of the next video file is advanced about 21 seconds from where it's 
> supposed to be. For example if the first video were timestamped 6:00:00 
> UTC, the next one will start at 12:00:24 instead of 12:00:03 where it 
> should be, taking into account time needed to start and stop the 
> recording. It's like there is really 6:00:21 of video being pulled off 
> the card, but it's being output at a (very) slightly higher framerate, 
> resulting in a 6:00:00 file. This seems to be due to NTSC 30000/1001 
> framerate vs. straight 30 fps discrepancy. I haven't been able to figure 
> out exactly why this is happening. Can anyone give me a tip on what's 
> going on here and how to solve it? Thanks in advance.

The 30000/1001 v.s. 30 fps seems like a good guess based on the 21 second 
difference. E.g. the camera reports 30 fps when it in fact runs at 29.97.

I'd check what is detected, and what is written to the output file as 
frame rate. You may try overriding the input frame rate with -r option.

There is also another approach to make this kind of chunked recording, 
using the segment muxer of ffmpeg.

https://www.ffmpeg.org/ffmpeg-all.html#toc-segment_002c-stream_005fsegment_002c-ssegment

By using options -segment_time and -segment_atclocktime you can make the 
system create 6 hour chunks, the ffmpeg command does not have to be 
restarted, and there will be no gaps between recordings.

Regards,
Marton


More information about the ffmpeg-user mailing list