This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Create Audio/Video Interleaved (AVI) file from MATLAB movie

    Note:   movie2avi will be removed in a future release. Use VideoWriter instead.


movie2avi(mov, filename)
movie2avi(mov, filename, ParameterName, ParameterValue)


movie2avi(mov, filename) creates the AVI file filename from the MATLAB® movie mov. The filename is specified as a character vector. The mov input is a 1-by-n structure array, where n is the number of frames. Each frame is a structure with two fields: cdata and colormap. For more information, see getframe.

movie2avi(mov, filename, ParameterName, ParameterValue) accepts one or more comma-separated parameter name/value pairs. The following table lists the available parameters and values.

Parameter Name




An m-by-3 matrix defining the colormap for indexed AVI movies, where m is no more than 256 (236 for Indeo compression).

Valid only when the 'compression' is 'MSVC', 'RLE', or 'None'.

No default


A character vector specifying the compression codec to use. To create an uncompressed file, specify a value of 'None'.

On UNIX® operating systems, the only valid value is 'None'.

On Windows® systems, valid values include:

  • 'MSVC'

  • 'RLE'

  • 'Cinepak' on 32-bit systems.

  • 'Indeo3' or 'Indeo5' on 32-bit Windows XP systems.

Alternatively, specify a custom compression codec on Windows systems using the four-character code that identifies the codec (typically included in the codec documentation). If MATLAB cannot find the specified codec, it returns an error.

'Indeo5' on Windows systems.

'None' on UNIX systems.


A scalar value specifying the speed of the AVI movie in frames per second (fps).

15 fps


For compressors that support temporal compression, the number of key frames per second.

2.1429 key frames per second


A number from 0 through 100. Higher quality numbers result in higher video quality and larger file sizes. Lower quality numbers result in lower video quality and smaller file sizes.

Valid only for compressed movies.



A descriptive name for the video stream, no more than 64 characters.



Create a movie and write to an uncompressed AVI file, myPeaks.avi:

nFrames = 20;

% Preallocate movie structure.
mov(1:nFrames) = struct('cdata', [],...
                        'colormap', []);

% Create movie.
Z = peaks; surf(Z); 
axis tight manual
for k = 1:nFrames 
   mov(k) = getframe(gcf);

% Create AVI file.
movie2avi(mov, 'myPeaks.avi', 'compression', 'None');

More About

collapse all


  • On some Windows systems, including all 64-bit systems, the default Indeo® 5 codec is not available. MATLAB issues a warning, and creates an uncompressed file.

  • On 32-bit Windows XP systems, MATLAB can create AVI files compressed with Indeo 3 and Indeo 5 codecs. However, Microsoft® Windows XP Service Pack 3 (SP3) with Security Update 954157 disables playback of Indeo 3 and Indeo 5 codecs in Windows Media® Player and Internet Explorer®. Consider specifying a compression value of 'None'.

Introduced before R2006a

Was this topic helpful?