C# Класс AForge.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( );
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Dispose the object.

Описание методов

AVIWriter() публичный метод

Initializes a new instance of the AVIWriter class.
Initializes Video for Windows library.
public AVIWriter ( ) : System
Результат System

AVIWriter() публичный метод

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.
Результат System

AddFrame() публичный метод

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.
Результат void

Close() публичный метод

Close video file.
public Close ( ) : void
Результат void

Dispose() публичный метод

Dispose the object.
Frees unmanaged resources used by the object. The object becomes unusable after that.
public Dispose ( ) : void
Результат void

Dispose() защищенный метод

Dispose the object.
protected Dispose ( bool disposing ) : void
disposing bool Indicates if disposing was initiated manually.
Результат void

Open() публичный метод

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.
Результат void