Matlab crashes when reading last frame of a video using mmreader( ) and read( )

1 次查看(过去 30 天)
I am trying to extract all the frames from a video file. I am currently using mmreader to get the video object. In order to read all the frames, I may need to know the total frames in the video.
Since vidObj.NumberOfFrames did not return the total number of frames directly, I followed the same way as suggested in Matlab reference to obtain the total frames :
vidObj = mmreader('varFrameRateFile.wmv');
lastFrame = read(vidObj, inf);
numFrames = vidObj.NumberOfFrames;
I gave in a video that has approximately >1000 total frames (*.mpg video), and Matlab crashed whenever it attempts to read the last frame with this line
lastFrame = read(vidObj, inf);
To further experiment, I estimated the total number of frames by
estimatedTotalFrames = duration * frameRate;
and then attempted to read a frame which index is close to the last frame :
frame = read(vidObj, estimatedTotalFrames * 0.9);
as expected, Matlab crashed as well :(
Does anyone know why did this happen?
I am using Matlab R2010a, in Windows 7 (32-bit) and I have K-lite Mega Version installed. Thanks in advance!

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by