You can read an AVI file into MATLAB using the built-in mmreader
class. Once you have the AVI frames read into a structure array of movie frames, you can save them as a YUV file using the saveFileYuv
function found in this submission from the MathWorks File Exchange:
Your code might look something like this:
%# Get the video data:
vidObj = mmreader( myVideo.avi ); %# Create a video file object
nFrames = vidObj.NumberOfFrames; %# Get the number of frames
vidHeight = vidObj.Height; %# Get the image height
vidWidth = vidObj.Width; %# Get the image width
%# Preallocate the structure array of movie frames:
mov(1:nFrames) = struct( cdata ,zeros(vidHeight,vidWidth,3, uint8 ),...
colormap ,[]); %# Note that colormap is empty!
%# Read each video frame into the structure array:
for k = 1:nFrames
mov(k).cdata = read(vidObj,k); %# Place frame k in the cdata field of mov(k)
end
%# Save the movie frame array as a YUV 4:2:0 file:
saveFileYuv(mov, myVideo.yuv ,1);