% 读取视频并保存每一帧
fileName = 'videoname.avi';
obj = VideoReader(fileName);
numFrames = obj.NumberOfFrames;% 帧的总数
for k = 1 : numFrames% 读取数据
frame = read(obj,k);
imwrite(frame,strcat(num2str(k),'.jpg'),'jpg');% 保存帧
end
更详细的解释见链接:https://blog.csdn.net/yuan13091324/article/details/44939805