---
title: "AVI Processor Add-on Concepts"
canonical: https://www.graphicsmill.com/docs/gm5/AVIProcessorAddonConcepts.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# AVI Processor Add-on Concepts
 
AVI Processor Add-on is an additional module for Graphics Mill for .NET. It enables you to add AVI files processing functionality to your application. This add-on is highly integrated with Graphics Mill for .NET and reuses a number of its classes and data types.
 
## Features of AVI Processor Add-on
  
Most important features of AVI Processor Add-on are highlighted below. You can:
 
- Get frames from AVI files to separate images;
- Read parameters of the AVI file (such as duration, frames per second, etc);
- Extract audio streams and save them as separate WAV files;
- Create new AVI files;
- Add frames to the AVI file (e.g. by loading them from separate image files, generating them with Graphics Mill, or extracting from another AVI file).
- Specify different encoding options like frame per second, compression, quality, etc when creating new AVI file.
- Add audio track from a separate WAV file or another AVI file. It is possible to append several audio files together.
- Put a watermark on each frame added to the AVI file. It can be:
    - An image.
    - Current date/time.
    - Frame timing information.
- Add transition effects between frames:
    - Stripe transition.
    - Fade out transition (changing transparency).
    - Custom transition.
- Possibility to enumerate installed codecs and get information about them.

**Note** 
AVI Processor Add-on is based on Video for Windows (VfW) API. It means that it derives all limitations of Video for Windows. In particular, it does not support AVI files which contains DV Type-1 data streams. Also, AVI files cannot exceed 1GB.
 
## AVI-related Classes
  
The structure of AVI Processor Add-on classes conform to general architecture of codecs of Graphics Mill for .NET. As for any other file format supported by Graphics Mill for .NET, the following classes are presented:
 
- [Aurigma.GraphicsMill.Codecs.AviReader](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviReader.htm.md) - the reader class. It is used to open the existing file and read different data from it. Read more detailed [how to work with readers](https://www.graphicsmill.com/docs/gm5/ReadingAVIFiles.htm.md).
- [Aurigma.GraphicsMill.Codecs.AviWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWriter.htm.md) - the writer class. It is used to create new AVI files. Read more detailed [how to work with writers](https://www.graphicsmill.com/docs/gm5/WritingAVIFiles.htm.md).
- [Aurigma.GraphicsMill.Codecs.AviFrame](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviFrame.htm.md) - the frame class. It represents single video frame, including the image and other information. This class is used both by reader and writer.

Additionally, the following AVI-related classes are also included:
 
- [Aurigma.GraphicsMill.Codecs.AviCompressor](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviCompressor.htm.md) - incapsulates the functionality related with AVI codecs (or compressors). Read more detailed [how to work with compressors](https://www.graphicsmill.com/docs/gm5/WorkingwithCompressors.htm.md).
- [Aurigma.GraphicsMill.Codecs.AviAudioManager](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviAudioManager.htm.md) - the audio manager class. It incapsulates all audio-related features in AVI Processor. It is used both in reader and writer to extract/add audio tracks from/to the AVI files. Read more detailed [how to work with audio](https://www.graphicsmill.com/docs/gm5/WorkingwithAudioTrack.htm.md).
- [Aurigma.GraphicsMill.Codecs.AviWatermark](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWatermark.htm.md) - enables to put a watermark on the AVI file when it is being written. Read more detailed [about watermarks](https://www.graphicsmill.com/docs/gm5/WorkingwithWatermarks.htm.md).
 
## Usage
  
This paragraph briefly describes how AVI Processor Add-on should be used. More detailed explanations can be found in subsequent sections.
 
To read the AVI file content, you should create the reader object and open it on this file (see the [Open](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_FormatReader_Open.htm.md) method for more details). After that you can extract frames either using `foreach` statement (the reader can be considered as a collection of frames in this case) or using the [LoadFrame(Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatReader_LoadFrame_1_e1836fc4.htm.md) method.
 
**Note** 
When you open the AVI file for reading, no data is actually loaded from it. The data is loaded only on demand, i.e. when you get the image from the frame. This way AVI Processor Add-on is memory-friendly.
 
However when the file is opened, it becomes locked by the application. No other application can remove or modify this AVI file. That's why it is highly recommended to close or dispose the reader object as soon as possible.
 
As soon as you get the frame, you can get the image stored in it. Use the [GetBitmap(Bitmap)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_Frame_GetBitmap_1_fd4033ef.htm.md) method to do it. It will return an instance of the [Aurigma.GraphicsMill.Bitmap](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Bitmap.htm.md) class. If you need to get a resized copy of this image, you can use the [GetThumbnail(Bitmap, Int32, Int32)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_Frame_GetThumbnail_3_90f33463.htm.md) method instead. Also, you can get the dimensions and pixel format of the frame without loading the bitmap itself. It will be faster than receiving the bitmap first and retrieving appropriate properties from it.
 
If you need to extract the audio track, you need to get an audio manager object associated with the reader. You can do it using the [AviReader.AudioManager](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_AviReader_AudioManager.htm.md) property. It will return the Aurigma.GraphicsMill.Codecs.AviAudioManager class instance. It provides access to audio tracks (or streams) of the AVI file (note, one AVI file can contain several audio streams). To retrieve the number of audio streams in the AVI file, use the [AudioStreamCount](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_AviAudioManager_AudioStreamCount.htm.md) property. You can use this value to organize a loop to iterate each audio stream. All methods which retrieve the information about the audio stream require the number of the stream to get data for. [Working with Audio Track](https://www.graphicsmill.com/docs/gm5/WorkingwithAudioTrack.htm.md) topic provides more details on this.
 
To create new AVI file, you need to instantiate the writer object. After it you initialize the writer settings like compression handler (i.e. the number which identifies some codec, the same as FOURCC code, but in numeric form), etc. When the writer settings are initialized, you can open the writer on a new AVI file (it will be created automatically). As soon as the writer is opened, it is ready to be filled with the video data. Just call the [AddFrame(IFrame)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatWriter_AddFrame_1_7fae152b.htm.md) method for each frame you want to add. To put the image (Aurigma.GraphicsMill.Bitmap instance) into the frame, use the [SetBitmap(Bitmap)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_Frame_SetBitmap_1_fd4033ef.htm.md) method of the frame object.
 
If you need to add audio streams to the AVI file, you should use the [AviWriter.AudioManager](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_AviWriter_AudioManager.htm.md) property. It will return the same Aurigma.GraphicsMill.Codecs.AviAudioManager object, but this time you should use [AddAudioStream](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_AviAudioManager_AddAudioStream.htm.md) and [AppendAudioStream](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_AviAudioManager_AppendAudioStream.htm.md) methods to add/append the audio data. Note, audio data should be added after you put all necessary video data.
 
**Note** 
As soon as you finished adding frames to the writer, you need to close the writer with the [Close()](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatWriter_Close.htm.md) method. It will unlock the file and flush all unsaved data.
 
## See Also
  
### Manual
 
- [Reading AVI Files](https://www.graphicsmill.com/docs/gm5/ReadingAVIFiles.htm.md)
- [Writing AVI Files](https://www.graphicsmill.com/docs/gm5/WritingAVIFiles.htm.md)
- [Working with Audio Track](https://www.graphicsmill.com/docs/gm5/WorkingwithAudioTrack.htm.md)
- [Working with Compressors](https://www.graphicsmill.com/docs/gm5/WorkingwithCompressors.htm.md)
- [Working with Watermarks](https://www.graphicsmill.com/docs/gm5/WorkingwithWatermarks.htm.md)
