C# Class Accord.Video.VFW.AVIWriter

AVI files writing using Video for Windows interface.

The class allows to write AVI files using Video for Windows API.

Sample usage:

// instantiate AVI writer, use WMV3 codec AVIWriter writer = new AVIWriter( "wmv3" ); // create new AVI file and open it writer.Open( "test.avi", 320, 240 ); // create frame image Bitmap image = new Bitmap( 320, 240 ); for ( int i = 0; i < 240; i++ ) { // update image image.SetPixel( i, i, Color.Red ); // add the image as a new frame of video file writer.AddFrame( image ); } writer.Close( );
Inheritance: IDisposable
Show file Open project: accord-net/framework

Public Methods

Method Description
AVIWriter ( ) : System

Initializes a new instance of the AVIWriter class.

Initializes Video for Windows library.

AVIWriter ( string codec ) : System

Initializes a new instance of the AVIWriter class.

Initializes Video for Windows library.

AddFrame ( Bitmap frameImage ) : void

Add new frame to the AVI file.

The method adds new video frame to an opened video file. The width and heights of the frame should be the same as it was specified in Open method (see Width and Height properties).

Close ( ) : void

Close video file.

Dispose ( ) : void

Dispose the object.

Frees unmanaged resources used by the object. The object becomes unusable after that.

Open ( string fileName, int width, int height ) : void

Create new AVI file and open it for writing.

The method opens (creates) a video files, configure video codec and prepares the stream for saving video frames with a help of AddFrame method.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Dispose the object.

Method Details

AVIWriter() public method

Initializes a new instance of the AVIWriter class.
Initializes Video for Windows library.
public AVIWriter ( ) : System
return System

AVIWriter() public method

Initializes a new instance of the AVIWriter class.
Initializes Video for Windows library.
public AVIWriter ( string codec ) : System
codec string Codec to use for compression.
return System

AddFrame() public method

Add new frame to the AVI file.

The method adds new video frame to an opened video file. The width and heights of the frame should be the same as it was specified in Open method (see Width and Height properties).

Thrown if no video file was open. Bitmap size must be of the same as video size, which was specified on opening video file. A error occurred while writing new video frame. See exception message.
public AddFrame ( Bitmap frameImage ) : void
frameImage System.Drawing.Bitmap New frame image.
return void

Close() public method

Close video file.
public Close ( ) : void
return void

Dispose() public method

Dispose the object.
Frees unmanaged resources used by the object. The object becomes unusable after that.
public Dispose ( ) : void
return void

Dispose() protected method

Dispose the object.
protected Dispose ( bool disposing ) : void
disposing bool Indicates if disposing was initiated manually.
return void

Open() public method

Create new AVI file and open it for writing.

The method opens (creates) a video files, configure video codec and prepares the stream for saving video frames with a help of AddFrame method.

Failed opening the specified file. A error occurred while creating new video file. See exception message. Insufficient memory for internal buffer. Video file resolution must be a multiple of two.
public Open ( string fileName, int width, int height ) : void
fileName string AVI file name to create.
width int Video width.
height int Video height.
return void