-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Erroneous frame seek in VideoCapture::set (CAP_PROP_POS_FRAMES/CAP_PROP_POS_MSEC) #4890
Copy link
Copy link
Closed
Description
Transferred from http://code.opencv.org/issues/4081
|| Kesh Ikuma on 2014-12-22 22:14
|| Priority: Normal
|| Affected: branch 'master' (3.0-dev)
|| Category: highgui-video
|| Tracker: Bug
|| Difficulty:
|| PR:
|| Platform: x64 / Windows
Erroneous frame seek in VideoCapture::set (CAP_PROP_POS_FRAMES/CAP_PROP_POS_MSEC)
Setting either CAP_PROP_POS_FRAMES or CAP_PROP_POS_MSEC property does not always result in correct frame. I am using the prebuilt binary (x64/vc12/opencv_world300d.dll) in OpenCV 3.0-beta release. The issue can be observed in the following code snippet:
Mat rgb_frame;
VideoCapture cap("C:\myvideo.mp4");
cap.set(CAP_PROP_POS_FRAMES,503); // goto Frame 503
fprintf(0,"current frame: %f\n",cap.get(CAP_PROP_POS_FRAMES); // returns 503
cap.read(rgb_frame); // returns Frame 500
The behavior is consistent with both CAP_PROP_POS_FRAMES and CAP_PROP_POS_MSEC properties.
For the video file that I'm analyzing (FFmpeg stream info - Video: h264 (High) (avc1 / 0x31637661), yuv420p, 128x512, 225 kb/s, 30 fps, 30 tbr, 10000k tbn, 60 tbc) the frame is set correctly up to Frame 502, but when it is set to Frame 503, the subsequent read operation retrieves Frame 500 (3 frames earlier) although the get function returns 503. The offset is not consistent thereafter. Here is the summary of the observed offsets up to the first 3000 frames:
Frame Range Offset
0-502 0
503-1443 3
1444-1646 4
1647-2888 3
2889-3000 0 (non-zero offset shows up again in the later frames)
History
Maksim Shabunin on 2015-04-27 09:12
- Target version changed from 3.0-beta to 3.0
Reactions are currently unavailable