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.
This workaround fails,
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 ; while isGood nFrame = nFrame + 1 ; try thisFrame = read(videoObj, nFrame) ; catch isGood = false ; nFrame = nFrame - 1 ; % Don't include in the count if fails end end
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.
Have you tried something like this:
xyloObj = VideoReader('xylophone.mpg'); xylDat = read(xyloObj); size(xylDat)
For this example, which is the mpg in the link provided, the final value in size is the number of frames. If this does not help, can you do a:
get(videoObj)
and post the results? I would be interested to see what data is missing.
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.