This documentation is for the old version. Go to the latest Graphics Mill docs

AviWriter Class

This class is intended to create new AVI files.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill.Codecs.AviProcessor (in Aurigma.GraphicsMill.Codecs.AviProcessor.dll)


Visual Basic
Public NotInheritable Class AviWriter _
	Inherits FormatWriter _
	Implements ITimeWriter
public sealed class AviWriter : FormatWriter, ITimeWriter


AVI stands for Audio Video Interleave. This is a file format for video movies which can contain both video and audio data. Inside the AVI file these data is organized into so-called data streams. One AVI file can store several video and audio streams. When an video player software plays the AVI file, it uses one video and one audio stream at one time (allowing the user to switch between streams). AVI Processor add-on supports only one video and any number of audio streams.

Video streams are presented as a sequense of images which are called frames. The AviWriter class enables you to add any reasonable number of frames using the AddFrame(IFrame) method.


AVI Processor add-on is based on Microsoft API called Video for Windows (VfW). This API imposes some limitations, in particular for the AVI file size. It cannot be more than 1GB. VfW does not support any modifications of AVI format which overcome this limitation (in particular, DV type 1). You should keep this fact in mind when creating AVI movies. The AddFrame(IFrame) method will fail if you try to add more frames to the AVI file which exceeds 1GB.

To work with audio streams, you should use the AviAudioManager object returned through the AudioManager property. It enables you to add new sound tracks from WAV files or append audio data to existing audio streams.

Since plain sequense of bitmaps occupies too much space, it is usually video compression is used. Compression is implemented in separate DLLs (so-called VfW-codecs, represented as AviCompressor class in AVI Processor) and they are independant on the AVI Processor. Some codecs are installed on each system by default, another ones should be obtained from independent vendors. Each such codec is identified by the so-called FOURCC code (4-byte string value). If to interpret the FOURCC bytes sequence as an integer value rather than string, you will get so-called compressor handler. To specify what codec the writer object should use, set the CompressorHandler property of the writer to the compressor handler of an appropriate codec.

When you create the AVI file, you can set more parameters than just compressor handler. In particular, you can specify the output quality, number of frames per second, etc. You can either do it programmatically (using such properties as Quality, FramesPerSecond, etc) or have the user to set parameters via special dialog. This dialog is implemented by the compressor vendor, and typically it enables to specify extra output settings. To display this dialog, use ShowOptionDialog and OptionsDialogParentHandle properties.

In general the writer usage workflow should be the following:

  1. Create the AviWriter instance.
  2. Initialize its parameters (such as CompressorHandler, FramesPerSecond, ShowOptionDialog, and others).
  3. Open the writer using the Open(String) method.

    After you open the writer, you will not be able to change its settings.

  4. For each bitmap you want to put to the video, create the AviFrame object, put this bitmap into it and add this frame using the AddFrame(IFrame) method.
  5. If you need audio tracks, use AudioManager property. Read the AviAudioManager class overview for more details.

Inheritance Hierarchy

Thread Safety

Static members of this type are safe for multi-threaded operations. Instance members of this type are safe for multi-threaded operations.

Object Model

Supported Pixel Formats

Member NameDescription
Format24bppRgb24 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components.
Format32bppRgb32 bits per pixel. RGB. 8 bits each are used for the red, green, and blue components. The rest 8 bits are unused.

See Also