CV_CAP_PROP_FRAME_COUNT returns incorrect frame count from ffmpeg (Bug #1287)


Added by Michael Richards over 13 years ago. Updated over 12 years ago.


Status:Done Start date:
Priority:Normal Due date:
Assignee:Alexander Reshetnikov % Done:

0%

Category:highgui-video
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

Calling get(CV_CAP_PROP_FRAME_COUNT) returns an incorrect frame count when a video contains duplicate frames. I assumed this was an ffmpeg bug and submitted:

https://avcodec.org/trac/ffmpeg/ticket/384#comment:2

It would appear that the problem is actually with our use of ffmpeg library not taking these duplicate frames into account.

In the attached example opencv claims there are 813 frames when in actual fact there are only 684 decodable frames.


VID_00003-20100701-2204.3GP (3 MB) Michael Richards, 2011-08-09 03:24 pm


History

Updated by Michael Richards over 13 years ago

Verified that the problem still occurs in newer release: 2.3.1.

Updated by Alexander Reshetnikov about 13 years ago

  • Status deleted (Open)

Updated by Alexander Shishkov almost 13 years ago

  • Priority changed from High to Normal
  • Target version deleted ()

Updated by Alexander Shishkov almost 13 years ago

  • Status set to Open

Updated by Alexander Shishkov almost 13 years ago

  • Assignee deleted (Alexander Reshetnikov)

Updated by Carlos M. almost 13 years ago

This problem -- like anything related to CV_CAP_PROP_* -- gives newcomers a very bad impression of the quality of OpenCV. Having people get stuck within the first few pages of the O'Reilly Book will not facilitate adoption of OpenCV. It does not matter whose fault this is, it just needs to get fixed.

Updated by Alexander Shishkov almost 13 years ago

  • Target version deleted ()

Updated by Andrey Morozov almost 13 years ago

  • Target version set to 2.4.0

Updated by Alexander Reshetnikov almost 13 years ago

Michael, what ffmpeg version have you used?
I've tested new ffmpeg wrapper (http://code.opencv.org/svn/opencv/branches/2.4/opencv/modules/highgui/src/cap_ffmpeg_impl_v2.hpp, versions from 0.7.x to 0.10.x) on this video and it gives very different results: 1179 frames returned as duration*fps and the same frames read by the cycle of frame queries. In r7919 was updated getProperty method for VideoCapture and it gives the same results in standard ffmpeg under Ubuntu 10.04.

  • Status changed from Open to Done
  • Assignee set to Alexander Reshetnikov

Updated by Andrey Kamaev over 12 years ago

  • Category changed from highgui-images to highgui-video

Also available in: Atom PDF