AVI (.avi)

  • Import and Export support the AVI standard.
  • Export generates uncompressed RGB frames, using a color resolution of 8 bits per channel.
  • Background

      Registered MIME type: video/avi
      Microsoft AVI format.
      Multimedia container format.
      Commonly used for archiving and exchanging video content.
      Stores audio and video content in a format suitable for synchronous playback.
      AVI is an acronym for Audio Video Interleave.
      Binary format.
      Supports a variety of audio and video codecs, as well as uncompressed video frames.
      Introduced in 1992 by Microsoft.

    Import and Export

    • Import["file.avi"] imports an AVI file and returns a list of frame indices.
    • Export["file.avi",list] exports a list of graphics, images, or arbitrary expressions, taking each element to be an animation frame.
    • Export can convert Manipulate, Animate, and ListAnimate expressions to the AVI format.
    • Export["file.avi",{expr1,expr2,}] exports a list of arbitrary expressions to AVI.
    • When exporting a list {expr1,expr2,}, the animation is composed from frames corresponding to rasterized images of the expri.
    • Export["file.avi",Manipulate[]] exports an animated demonstration of a Manipulate object to an AVI file.
    • The exported AVI video will play at the same speed and will have the same size as the Manipulate object.
    • Export["file.avi",ListAnimate[]] exports a ListAnimate object as an AVI video.
    • Import["file.avi",elem] imports the specified element from an AVI file.
    • Import["file.avi",{elem,suba,subb,}] imports a subelement.
    • Import["file.avi",{{elem1,elem2,}}] imports multiple elements.
    • The import format can be specified with Import["file","AVI"] or Import["file",{"AVI",elem,}].
    • Export["file.avi",expr,elem] creates an AVI file by treating expr as specifying element elem.
    • Export["file.avi",{expr1,expr2,},{{elem1,elem2,}}] treats each expri as specifying the corresponding elemi.
    • Export["file.avi",expr,opt1->val1,] exports expr with the specified option elements taken to have the specified values.
    • Export["file.avi",{elem1->expr1,elem2->expr2,},"Rules"] uses rules to specify the elements to be exported.
    • See the reference pages for full general information on Import and Export.
    • ImportString and ExportString support the AVI format.


    • General Import elements:
    • "Elements"list of elements and options available in this file
      "Rules"full list of rules for each element and option
      "Options"list of rules for options, properties, and settings
    • Data representation elements:
    • "Animation"animation object
      "Data"array of raw bitmap data for each frame
      "Frames"list of integer indices representing the sequence of still pictures in the file
      "Frames",nthe n^(th) frame
      "GraphicsList"frames represented as a list of graphics objects
      "ImageList"frames represented as a list of images
      "ImageList",nthe n^(th) frame as an image
      "ImageList",{n1,n2,}multiple frames
    • Import by default uses the "Frames" element.
    • Meta-information elements available for Import:
    • "BitDepth"bits used to represent each color channel in the file
      "ColorSpace"color encoding used in the file
      "Duration"animation length in seconds
      "FrameCount"number of frames in the file
      "FrameRate"number of frames to be displayed per second
      "ImageSize"raster dimensions
      "VideoEncoding"video codec used in the file
    • Internal`$VideoEncodings gives a list of video codecs available on your computer system.
    • Commonly available codecs include "YUV", "H261", "H263", "JPEG", "Uncompressed", "Cinepak", and "MotionJPEG".


    • General options:
    • BackgroundWhitecolor of area padded around the exported animation
      ImageSizeAutomaticpixel dimensions of the animated object
    • With the setting ImageSize -> Automatic, Export will create frames whose pixel dimensions are multiples of four, as required by common AVI player applications.
    • Advanced Export option:
    • "FrameRate"15number of frames to be displayed per second


    Basic Examples  (5)

    Export a sequence of images to AVI:

    Click for copyable input

    Import metadata:

    Click for copyable input

    This gives a list of integer indices that can be used to reference individual frames:

    Click for copyable input

    Import frames 5 and 6:

    Click for copyable input

    Import the entire AVI file as an animation object:

    Click for copyable input

    See Also

    "QuickTime"  "SWF"  "FLV"  "GIF"  "TIFF"


    Introduced in 2003
    | Updated in 2010