vid=mmreader('video.avi'); numFrames = vid.NumberOfFrames; n=numFrames; for i = 1:2:n frames = read(vid,i); imwrite(frames,['Image' int2str(i), '.jpg']); im(i)=image(frames); end
You can use the VideoReader class to set the starting time of the video, then use read() to extract a frame from the video at exactly that time. Then use imwrite() to save it to disk. Attached is a demo that does something similar (but not exactly what you want). The demo writes out every single frame to files. You just need to set the time with the method for doing that before you extract the frame.