Extracting frames from videos in Matlab

mmreader class is used to read a video object and then this video object is used to read number of frames as obj.NumberOfFrames

Example

obj = mmreader('Megamind.avi');
vid = read(obj);
frames = obj.NumberOfFrames;
for x = 1 : frames
    imwrite(vid(:,:,:,x),strcat('frame-',num2str(x),'.jpeg'));
end
Share

You may also like...