Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

VFR: obtain FR/duration/timestamp of a given frame?

I have a video which freezes for a few seconds. I know for a fact that the freeze spans a real window of time during which the camera or camera-to-storage system simple failed to save frames, but thanks for a timecode generator on the camera, the camera is able to label the frozen frame as of long duration spanning the freeze, so that a video player knows to pause at the frozen frame during playback in order to maintain realtime playback. Likewise, MediaInfo reports that the video has a very low minimum frame rate of .083 FPS, obviously corresponding to the frozen frame of course. So I know the metadata for the freeze is in there. QT Player knows to pause at that point during playback and MediaInfo can see the min FR.

I need to obtain this information during Python CV2 analysis. I know about CAP_PROP_FPS of course, but that isn't helpful for a VFR, and I know that I can seek to a given timestamp to retrieve a frame with CAP_PROP_POS_MSEC, and of course if I seek within the frozen period I simply receive the same frame over and over until I seek to some timestamp outside the freeze, so OpenCV can give me the frame for each timestamp, but I want to ask how long a given frame should last? If I simply read frames in sequence via read(), I want to know how long each frame should last. In effect, if I'm emulating playback, like QT player, how do I know how long to pause on each frame, ala the variable frame rate and all that?

Thanks.