This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Export to Video

To create an Audio/Video Interleaved (AVI) file from MATLAB® graphics animations or from still images, follow these steps:

  1. Create a VideoWriter object by calling the VideoWriter function. For example:

    myVideo = VideoWriter('myfile.avi');

    By default, VideoWriter prepares to create an AVI file using Motion JPEG compression. To create an uncompressed file, specify the Uncompressed AVI profile, as follows:

    uncompressedVideo = VideoWriter('myfile.avi', 'Uncompressed AVI');
  2. Optionally, adjust the frame rate (number of frames to display per second) or the quality setting (a percentage from 0 through 100). For example:

    myVideo.FrameRate = 15;  % Default 30
    myVideo.Quality = 50;    % Default 75


    Quality settings only apply to compressed files. Higher quality settings result in higher video quality, but also increase the file size. Lower quality settings decrease the file size and video quality.

  3. Open the file:



    After you call open, you cannot change the frame rate or quality settings.

  4. Write frames, still images, or an existing MATLAB movie to the file by calling writeVideo. For example, suppose that you have created a MATLAB movie called myMovie. Write your movie to a file:

    writeVideo(myVideo, myMovie);

    Alternatively, writeVideo accepts single frames or arrays of still images as the second input argument. For more information, see the writeVideo reference page.

  5. Close the file:


See Also