Erroneous frame seek in VideoCapture::set (CAP_PROP_POS_FRAMES/CAP_PROP_POS_MSEC) (Bug #4081)


Added by Kesh Ikuma about 10 years ago. Updated over 9 years ago.


Status:New Start date:2014-12-22
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:highgui-video
Target version:3.0
Affected version:branch 'master' (3.0-dev) Operating System:Windows
Difficulty: HW Platform:x64
Pull request:

Description

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)


Associated revisions

Revision a28c8d00
Added by Vadim Pisarevsky almost 10 years ago

Merge pull request #4081 from vpisarev:30_small_fixes

History

Updated by Maksim Shabunin almost 10 years ago

  • Target version changed from 3.0-beta to 3.0

Updated by Maksim Shabunin over 9 years ago

Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4890

Also available in: Atom PDF