VIDEO PROCESSING Using MATLAB

MATLAB provides the necessary functionality for basic video processing tasks using a limited number of video formats. Not very long ago, the only video formats supported by built-in MATLAB functions was only the AVI, through functions such as aviread, avifile, movie2avi, & aviinfo. Moreover, the support was OS dependent & limited only to a few video codecs. Then with newer versions of MATLAB, new library functions like mmreader, was introduced to extend video support of video formats such as AVI, MPEG, and WMV (But it was true for only Windows Platform).
MATLAB represent the monochrome & colored video by creating the manipulative, 3 dimensional or 4 dimensional matrix, but provided that the video sequences are short, i.e., only few minutes of it.
When a frame needs to be processed individually, it can be easily converted into an image using the "frame2im" function, which can then be processed using any of the functions available in the Image Processing Toolbox of MATLAB.

The MATLAB functions associated with reading video files:
aviread: to read an AVI video file & store the frames into a MATLAB video structure, which may me actually 3D or 4D matrices, containing information about the monochrome or colored frames.
aviinfo: returns a structure who contains information such as, frame width, frame height, total number of frames, frame rate, file size, etc
mmreader: constructs a multimedia [here mm stands for multimedia] object that can read video data from a variety of multimedia file formats.

Processing Video Files In MATLAB
Steps can be put in a loop if the same type of processing is to be applied to all frames of video file:
1. Convert frame to an image using frame2im.
2. Process the image using any function as required by the image processing task.
3. Then Convert the result back into a frame using im2frame function.

Playing Video Files In MATLAB
movie: a built-in video player of MATLAB
implay: a fully functional built in image & video player with many options.

Writing Video Files in MATLAB
avifile: creates a new AVI file that can then be populated with video frames
in a variety of ways.
movie2avi: creates an AVI file, from MATLAB Frame Sequence.