VideoCapture unable to read large AVI files (wrong frame count)
Hey there!
CONTEXT
In our projects we work with very large video files (5-6h of recordings at a time). We usually encode in MJPEG to make moving through the videos more reasonable (using ffmpeg), which gives us files of 30Gb or thereabouts each time.
PROBLEM
When using VideoCapture to read the avi files, using the following code :
VideoCapture input = VideoCapture(pathString);
if (!input.isOpened()) return;
int frameCount = input.get(CV_CAP_PROP_FRAME_COUNT);
We get the wrong amount of frames (~14'300 frames instead of the correct ~400'000-500'000). VideoCapture is then able to read through the file but only up to frame #14'300 or thereabouts. The problem happens on both linux and osx.
WHAT WE TRIED
The (now deprecated) CvCapture reads the file size properly and allows to read through the entire videos with no issues. Our only problem is that it's much slower to read the files compared to VideoCapture (same files, same machines). (It is our current fallback solution.)
The "trick" from the examples code (reading the file size "manually" off the avi RIFF header) returns the same wrong frame count as getting CV_CAP_PROP_FRAME_COUNT off VideoCapture. This comes, I guess, from the 2gb limit that AVI files had in the old days, but as CvCapture (in both opencv2 and opencv3) is able to read the files properly, I guess that the 2gb limit is not (or should not be) a deal breaker.
THE QUESTION
Any ideas on how to get VideoConverter to work properly? If that is not possible then how to know the proper file size from an over-sized avi file? And barring that any idea on an alternative way of reading through videos in a quicker way than CvCapture?
Any help would be greatly appreciated!
Best, Basilio
There seem to have been someone with a similar problem 4 years ago with a previous version of opencv, which had at the time been resolved: http://answers.opencv.org/question/14... Unfortunately I doubt that "switching compiler" works here since I'm having the exact same problem on multiple machines and both OSX and linux...