此为 Mathematica 7 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.2)
Import/Export 导入/导出 格式

AVI (.avi)

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.
  • Export generates uncompressed RGB frames, using a color resolution of 8 bits per channel.
  • Import["file.avi"] imports an AVI file and returns a list of frame indices.
  • Export["file.avi", list] exports a list of graphics or a list of arbitrary expressions, taking each element to be an animation frame.
  • 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.
  • The exported AVI video will play at the same speed and will have the same size as the Manipulate object.
  • 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.
"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"animated AVI represented as an animation object
"Data"array of raw bitmap data for each frame
"GraphicsList"frames of an animated AVI as a list of graphics
  • Accessing individual frames:
"Frames"list of integers used to reference individual frames
"Frames",nthe n^(th) frame as an image
  • 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
  • Import supports the following codecs: "YUV", "H261", "H263", "JPEG", "Uncompressed", "Cinepak", "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 4 as required by common AVI player applications.
"FrameRate"15number of frames to be displayed per second
Export a list of 2D graphics generated from the evolution of a cellular automaton:
In[1]:=
Click for copyable input
Out[1]=
Show the Import elements available in the generated file:
In[2]:=
Click for copyable input
Out[2]=
Import meta-information elements:
In[3]:=
Click for copyable input
Out[3]=
This gives a list of integer indices which can be used to reference individual frames:
In[4]:=
Click for copyable input
Out[4]=
Import frames 10 and 30:
In[5]:=
Click for copyable input
Out[5]=
Import the entire AVI file as an animation object:
In[6]:=
Click for copyable input
Out[6]=