VideoWriter Create a video writer object.
OBJ = VideoWriter(FILENAME) constructs a VideoWriter object to
write video data to an AVI file that uses Motion JPEG compression.
FILENAME is a string enclosed in single quotation marks that specifies
the name of the file to create. If filename does not include the
extension '.avi', the VideoWriter constructor appends the extension.
OBJ = VideoWriter( FILENAME, PROFILE ) applies a set of properties
tailored to a specific file format (such as 'Uncompressed AVI') to
a VideoWriter object. PROFILE is a string enclosed in single
quotation marks that describes the type of file to create.
Specifying a profile sets default values for video properties such
as VideoCompressionMethod. Possible values:
'Motion JPEG AVI' - Compressed AVI file using Motion JPEG codec.
(default)
'Uncompressed AVI' - Uncompressed AVI file with RGB24 video.
Methods:
open - Open file for writing video data.
close - Close file after writing video data.
writeVideo - Write video data to file.
getProfiles - List profiles and file format supported by VideoWriter.
Properties:
ColorChannels - Number of color channels in each output
Video frame.
Duration - Scalar value specifying the duration of the
file in seconds.
FileFormat - String specifying the type of file to write.
Filename - String specifying the name of the file.
FrameRate - Rate of playback for the video in frames per
second. After you call open, you cannot
change the FrameRate value.
Height - Height of each video frame in pixels.
The writeVideo method sets values for Height
and Width based on the dimensions of the
first frame.
Path - String specifying the fully qualified file
path.
Quality - Integer from 0 through 100. Only applies to
objects associated with the Motion JPEG
AVI profile. Higher quality numbers result
in higher video quality and larger file
sizes. Lower quality numbers result in
lower video quality and smaller file
sizes. After you call open, you cannot
change the Quality value.
VideoBitsPerPixel - Number of bits per pixel in each output
video frame.
VideoCompressionMethod - String indicating the type of video
compression.
VideoFormat - String indicating the MATLAB representation
of the video format.
VideoFrameCount - Number of frames written to the video file.
Width - Width of each video frame in pixels.
The writeVideo method sets values for Height
and Width based on the dimensions of the
first frame.
Example:
% Prepare the new file.
vidObj = VideoWriter('peaks.avi');
open(vidObj);
% Create an animation.
Z = peaks; surf(Z);
axis tight
set(gca,'nextplot','replacechildren');
for k = 1:20
surf(sin(2*pi*k/20)*Z,Z)
% Write each frame to the file.
currFrame = getframe;
writeVideo(vidObj,currFrame);
end
% Close the file.
close(vidObj);
See also VideoWriter/open, VideoWriter/close,
VideoWriter/writeVideo, VideoWriter/getProfiles.
Reference page in Help browser
doc VideoWriter
<mmfileinfo> - Return information for a multimedia file.
MMFILEINFO Information about a multimedia file.
INFO = MMFILEINFO(FILENAME) returns a structure whose fields contain
information about FILENAME's audio and/or video data. FILENAME
is a string that specifies the name of the multimedia file.
The set of fields for the INFO structure are:
Filename - A string, indicating the name of the file.
Path - A string, indicating the absolute path to the file.
Duration - The length of the file in seconds.
Audio - A structure whose fields contain information about the
audio component of the file.
Video - A structure whose fields contain information about the
video component of the file.
The set of fields for the Audio structure are:
Format - A string, indicating the audio format.
NumberOfChannels - The number of audio channels.
The set of fields for the Video structure are:
Format - A string, indicating the video format.
Height - The height of the video frame.
Width - The width of the video frame.
See also audiovideo.
Reference page in Help browser
doc mmfileinfo
<movie2avi> - Create AVI movie from MATLAB movie.
MOVIE2AVI(MOV,FILENAME) Create AVI movie from MATLAB movie
MOVIE2AVI(MOV,FILENAME) creates an AVI movie from the MATLAB movie MOV.
MOVIE2AVI(MOV,FILENAME,PARAM,VALUE,PARAM,VALUE...) creates an AVI movie from
the MATLAB movie MOV using the specified parameter settings.
Available parameters
FPS - The frames per second for the AVI movie. The default
is 15 fps.
COMPRESSION - A string indicating the compressor to use. On UNIX, this
value must be 'None'. Valid values for this parameter on Windows are
'Indeo3', 'Indeo5', 'Cinepak', 'MSVC', or 'None'. To use a custom
compressor, the value can be the four character code as specified by the
codec documentation. An error will result if the specified custom
compressor can not be found. The default is 'Indeo5' on Windows and
'None' on UNIX.
QUALITY - 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, where lower quality numbers result in
lower video quality and smaller file sizes. The default is 75.
KEYFRAME - For compressors that support temporal compression, this
is the number of key frames per second. The default is 2 key frames per
second.
COLORMAP - An M-by-3 matrix defining the colormap to be used for
indexed AVI movies. M must be no greater than 256 (236 if using Indeo
compression). There is no default colormap.
VIDEONAME - A descriptive name for the video stream. This parameter
must be no greater than 64 characters long. The default name is the
filename.
See also avifile, aviread, aviinfo, movie.
Reference page in Help browser
doc movie2avi
<avifile> - Create a new AVI file.
AVIFILE Create a new AVI file
AVIOBJ = AVIFILE(FILENAME) creates an AVIFILE object AVIOBJ with the default parameter values. If FILENAME does not include an extension,
then '.avi' will be used. Use AVIFILE/CLOSE to close the file opened by
AVIFILE. Use "clear mex" to close all open AVI files.
AVIOBJ = AVIFILE(FILENAME,'PropertyName',VALUE,'PropertyName',VALUE,...)
returns an AVIFILE object with the specified property values.
AVIFILE parameters
FPS - The frames per second for the AVI movie. This parameter
must be set before using ADDFRAME. The default is 15 fps.
COMPRESSION - A string indicating the compressor to use. On UNIX, this