---
title: "AviWriter Constructor (Stream, Int32, Int32, Int32, Int32, Int32, Boolean, IntPtr, Int32, Int32)"
canonical: https://www.graphicsmill.com/docs/gm5/C_Aurigma_GraphicsMill_Codecs_AviWriter_ctor_10_3ca87558.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/)

# AviWriter Constructor (Stream, Int32, Int32, Int32, Int32, Int32, Boolean, IntPtr, Int32, Int32)
 
Creates and initializes new [AviWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWriter.htm.md) class instance. You set all possible AVI writer parameters here. It also opens this writer on specified file.
 
**Namespace:** [Aurigma.GraphicsMill.Codecs](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
 **Assembly:** Aurigma.GraphicsMill.Codecs.AviProcessor (in Aurigma.GraphicsMill.Codecs.AviProcessor.dll)
 
## Syntax
  
```
Public Sub New ( _stream As Stream, _width As Integer, _height As Integer, _quality As Integer, _framesPerSecond As Integer, _compressorHandler As Integer, _showOptionDialog As Boolean, _optionDialogParent As IntPtr, _keyFrameRate As Integer, _bytesPerSecond As Integer _
)
```
 
```csharp
public AviWriter(Stream stream,int width,int height,int quality,int framesPerSecond,int compressorHandler,bool showOptionDialog,IntPtr optionDialogParent,int keyFrameRate,int bytesPerSecond
)
```
 
### Parameters
 
 - stream
     - Type: [System.IO.Stream](http://msdn2.microsoft.com/en-us/8f86tw9e)
Name of the file to open the writer on.

 - width
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
An integer value which specifies the width of the AVI you need to get. If 0 is specified, the width will be taken from the first frame added to the writer.

 - height
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
An integer value which specifies the height of the AVI you need to get. If 0 is specified, the height will be taken from the first frame added to the writer.

 - quality
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
 
Value in range [0, 10000] which specifies the quality of the AVI file. Higher values means better quality (but larger file size).
 
The quality setting is meaningful not for each AVI compressor. That's why it may be disregarded depending on the value of the [CompressorHandler](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_AviWriter_CompressorHandler.htm.md) property.

 - framesPerSecond
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
An integer value which specifies how many frames should be played in one second.

 - compressorHandler
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
An integer number containing the compressor handler.

 - showOptionDialog
     - Type: [System.Boolean](http://msdn2.microsoft.com/en-us/a28wyd50)
A [Boolean](http://msdn2.microsoft.com/en-us/a28wyd50) value which whether to display the options dialog to specify the writer object settings.

 - optionDialogParent
     - Type: [System.IntPtr](http://msdn2.microsoft.com/en-us/5he14kz8)
A value which contains the HWND of the options dialog parent window.

 - keyFrameRate
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
 
An integer value which specifies the key frame value.
 
This value is ignored by most compressors. It is used by those compressors which are based on MPEG algorithm (e.g. [DivXPro5](https://www.graphicsmill.com/docs/gm5/F_Aurigma_GraphicsMill_Codecs_AviCompressor_DivXPro5.htm.md), [XvidMpeg4](https://www.graphicsmill.com/docs/gm5/F_Aurigma_GraphicsMill_Codecs_AviCompressor_XvidMpeg4.htm.md), etc).

 - bytesPerSecond
     - Type: [System.Int32](http://msdn2.microsoft.com/en-us/td2s409d)
 
An integer value which specifies the amount of bytes per second.
 
This value is ignored by most compressors. It is used by those compressors which are based on MPEG algorithm (e.g. [DivXPro5](https://www.graphicsmill.com/docs/gm5/F_Aurigma_GraphicsMill_Codecs_AviCompressor_DivXPro5.htm.md), [XvidMpeg4](https://www.graphicsmill.com/docs/gm5/F_Aurigma_GraphicsMill_Codecs_AviCompressor_XvidMpeg4.htm.md), etc).
 
## Remarks
  
When you open the writer with this constructor, you will not be able to change the writer settings (such as dimensions, compressor settings, frames per second, etc). So use this constructor only if you are sure that you need not change the writer parameters. Otherwise you should:
 
1. Use the [constructor without parameters](https://www.graphicsmill.com/docs/gm5/C_Aurigma_GraphicsMill_Codecs_AviWriter_ctor.htm.md).
2. Initialize all necessary settings.
3. Use the [Open(Stream)](https://www.graphicsmill.com/docs/gm5/M_Aurigma_GraphicsMill_Codecs_FormatWriter_Open_1_bca7c9fe.htm.md) method to open the writer (when you are sure that the writer settings should not be changed).
   
## See Also

### Reference

- [AviWriter Class](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_AviWriter.htm.md)
- [AviWriter Overload](https://www.graphicsmill.com/docs/gm5/O_T_Aurigma_GraphicsMill_Codecs_AviWriter_ctor.htm.md)
- [Aurigma.GraphicsMill.Codecs Namespace](https://www.graphicsmill.com/docs/gm5/N_Aurigma_GraphicsMill_Codecs.htm.md)
