Matlab 视频格式转换



clc;
clear;
readerobj= mmreader('C:\Users\Administrator\Desktop\test\ui.avi')
vidFrames = read(readerobj);
numFrames = get(readerobj, 'numberOfFrames');
%Create a MATLAB movie struct from the video frames.
for k = 1 : numFrames
    mov(k).cdata = vidFrames(:,:,:,k);
    mov(k).colormap = [];
end
%Play back the movie once at the video's frame rate.
movie(mov, 1, readerobj.FrameRate);

%创建avi文件对象
aviobj = avifile('C:\Users\Administrator\Desktop\test\ui11.avi','compression','None');

for k=1:numFrames%图像序列个数
    %fname=strcat('..\imgdata\',num2str(i),'.jpg');
    frame = vidFrames(:,:,:,k);
    %加入avi对象中
    aviobj = addframe(aviobj,frame);
end
%关闭avi对象
aviobj = close(aviobj);

你可能感兴趣的:(Matlab)