The read () function and NumberOfFrames () field are now deprecated, Matlab suggests using
xyloObj = VideoReader(file);
vidHeight = xyloObj.Height;
vidWidth = xyloObj.Width;
mov = struct('cdata',zeros(vidHeight, vidWidth, 3,'uint8'), 'colormap',[]);
while hasFrame(xyloObj)
mov(k).cdata = readFrame(xyloObj,'native');
end
If you want to estimate the number of frames in a video, use nFrames = floor(xyloObj.Duration) * floor(xyloObj.FrameRate);