Ask Your Question

Revision history [back]

Problem with CV_CAP_PROP_POS_MSEC

Hi, I am trying to get the timestamp of a frame from a video that is variable frame rate. I tried to get the time stamps of frames through ffprobe, and it seems that the first frame has a timestamp of 20 msec, the second one 60msec, the third one 80 msec, fourth one 120 msec (so it oscillates between 20msec and 40 msec frame time diff and averages to approximately 30fps). When I use opencv (2.3.1 in Ubuntu 12.04) to query the timestamp in the following piece of code :

for(int frame_count = 0; frame_count < totalFrameCount-1; frame_count ++) { cap >> img_scene; // get a new frame from the file frameTimeStamp = cap.get(CV_CAP_PROP_POS_MSEC); cout << "FrameTimeStamp is " << frameTimeStamp; }

I get timestamps as 20 msec, 40 msec (instead of 60 msec), 60 msec and so on. So it is different that what ffprobe tells me. Is this a known issue ? (framenumber etc. seem to be a known issue, but frame msec seemed to be more stable).

Any help would be great,

Thanks