Create a new video file to write. (experimental)
n = avifile(filename, dims) n = avifile(filename, dims, fps) n = avifile(filename, dims, fps, fourcc)
A string, the video filename to be created.
A 1x2 vector, which indicates the frame size (width, height).
Frame per second.
4-character code of codec used to compress the frames.
'xvid', 'mjpg', 'pim1', 'mp42', 'divx','flv1', etc.
A number, the opened video file index.
In order to use certain codec, the codec must be installed.
For e.g., xvid required xvid codec (http://www.xvid.org) while the mpg required ffdshow codec. (http://www.free-codecs.com/ffdshow_download.htm) avifile create a new video file.
After the video file is created, addframe can be used to add frame to the file. Remember to close the opened file using aviclose(n) or avicloseall().
Video support for IPCV is only available when IPCV is compiled with OpenCV which support video I/O.
im = imread(fullpath(getIPCVpath() + "/images/baboon.png")); n = avifile('baboon.avi', [300;300], 30,'xvid'); for ii=1:200 ims = im(ii:512-ii, ii:512-ii, :); addframe(n, ims); end aviclose(n); | ![]() | ![]() |