| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
aviobj =
avifile(filename)
aviobj =
avifile(filename, Param1, Val1, Param2, Val2,
...)
aviobj = avifile(filename) creates an avifile object, giving it the name specified in filename, using default values for all avifile object properties. If filename does not include an extension, avifile appends .avi to the file name. AVI is a file format for storing audio and video data.
avifile returns a handle to an AVI file object aviobj. Use this object to refer to the AVI file in other functions. An AVI file object supports properties and methods that control aspects of the AVI file created.
aviobj = avifile(filename, Param1, Val1, Param2, Val2, ...) creates an avifile object with the property values specified by parameter/value pairs. This table lists available parameters.
Parameter | Value | Default | |
|---|---|---|---|
An m-by-3 matrix defining the colormap to be used for indexed AVI movies, where m must be no greater than 256 (236 if using Indeo compression). You must set this parameter before calling addframe, unless you are using addframe with the MATLAB movie syntax. This parameter can be specified only when the 'compression' parameter is set to 'MSVC', 'RLE', or 'None' | There is no default colormap. | ||
A text string specifying the compression codec to use. On Microsoft Windows operating systems:
On UNIX operating systems:
| '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, this is the number of key frames per second. | 2.1429 key frames per second. | ||
A number between 0 and 100. This parameter has no effect on uncompressed movies. Higher quality numbers result in higher video quality and larger file sizes. Lower quality numbers result in lower video quality and smaller file sizes. You must set this parameter before calling addframe. This parameter has no effect on uncompressed movies. | 75 | ||
A descriptive name for the video stream. This parameter must be no greater than 64 characters long and must be set before using addframe. | The default is the filename. | ||
You can also use structure syntax (also called dot notation) to set avifile object properties. The property name must be typed in full, however, it is not case sensitive. For example, to set the quality property to 100, use the following syntax:
aviobj = avifile('myavifile');
aviobj.quality = 100;All the field names of an avifile object are the same as the parameter names listed in the table, except for the keyframe parameter. To set this property using dot notation, specify the KeyFramePerSec property. For example, to change the value of keyframe to 2.5, type
aviobj.KeyFramePerSec = 2.5;
This example uses the avifile function to create the AVI file example.avi.
t = linspace(0,2.5*pi,40);
fact = 10*sin(t);
fig=figure;
aviobj = avifile('example.avi')
[x,y,z] = peaks;
for k=1:length(fact)
h = surf(x,y,fact(k)*z);
axis([-3 3 -3 3 -80 80])
axis off
caxis([-90 90])
F = getframe(fig);
aviobj = addframe(aviobj,F);
end
close(fig)
aviobj = close(aviobj);addframe (avifile), close (avifile), movie2avi
![]() | auwrite | aviinfo | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |