Aurigma Graphics Mill 5.5 for .NET
AviReader Class
This class is used to read frames from AVI files.
Namespace:
Aurigma.GraphicsMill.Codecs
Assembly:
Aurigma.GraphicsMill.Codecs.AviProcessor (in Aurigma.GraphicsMill.Codecs.AviProcessor.dll)
Syntax
Visual Basic
Public NotInheritable Class AviReader _ Inherits FormatReader _ Implements ITimeReader
C#
public sealed class AviReader : FormatReader, ITimeReader
Remarks
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 AviReader class enables you to extract frames using the LoadFrame(Int32) method. Also, the reader object can be interpreted as a collection of frames, and therefore you can enumerate frames using the foreach statement.
To work with audio streams, you should use the AviAudioManager object returned through the AudioManager property. It enables you to extract sound tracks of the movie to the separate WAV file. Also, you can use it to retrieve audio data from one AVI file to another.
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 identify what compressor was used to create the AVI file opened in the reader object, use the CompressorHandler property.
You can use the AviReader object not only to read audio or video data, but also to extract some information about the AVI file. For example, you can get its:
- Dimensions (Width and Height properties);
- Duration (Duration property);
- Number of frames per second (FramesPerSecond property).
In general the reader usage workflow should be the following:
- Create the AviReader instance.
- Open the reader using the Open(String) method.
- If necessary, read Duration, FramesPerSecond, etc.
-
Iterate through each frame in the reader using the LoadFrame(Int32) method. It will return an AviFrame class instance. To extract the image from the frame, use its method called GetBitmap(Bitmap).
To get the total number of frames in the reader, you can use the FrameCount property.
- If you need to get audio tracks, use the AudioManager property. Read the AviAudioManager class overview for more details how to work with it.




