I am having trouble using VideoReader to determine the correct number of frames in a video file,
videoObj = VideoReader('2_1107.mpg') ;
Warning: Unable to determine the number of frames in this file.
lastFrame = read(videoObj, inf)
Error using VideoReader/read (line 86)
The frame index requested is beyond the end of the file.
The following code returns a different number of frames each time it's run, e.g. 164, 263, 257.
videoObj = VideoReader('2_1107.mpg');
nFrame = 0 ;
isGood = true ;
nFrame = nFrame + 1 ;
thisFrame = read(videoObj, nFrame) ;
isGood = false ;
nFrame = nFrame - 1 ;
If VideoReader skipping or repeating frames on each pass through the file, how can I get the correct number of frames? More info: problem is present for both R2012a and R2012b run on Windows 7 (32-bit versions), video format is MPEG-2, size of the video is 65706 KB, and it's a variable frame rate file.