Table of Contents

Class VideoWriter

Namespace
Emgu.CV
Assembly
Emgu.CV.dll

Create a video writer that write images to video format

public class VideoWriter : UnmanagedObject, IDisposable
Inheritance
VideoWriter
Implements
Inherited Members

Constructors

VideoWriter(string, int, double, Size, bool)

Create a video writer using the specific information

public VideoWriter(string fileName, int compressionCode, double fps, Size size, bool isColor)

Parameters

fileName string

The name of the video file to be written to

compressionCode int

Compression code. Usually computed using CvInvoke.CV_FOURCC. On windows use -1 to open a codec selection dialog. On Linux, use CvInvoke.CV_FOURCC('I', 'Y', 'U', 'V') for default codec for the specific file name.

fps double

frame rate per second

size Size

the size of the frame

isColor bool

true if this is a color video, false otherwise

VideoWriter(string, int, Size, bool)

Create a video writer using the specific information. On windows, it will open a codec selection dialog. On linux, it will use the default codec for the specified filename

public VideoWriter(string fileName, int fps, Size size, bool isColor)

Parameters

fileName string

The name of the video file to be written to

fps int

frame rate per second

size Size

the size of the frame

isColor bool

true if this is a color video, false otherwise

VideoWriter(string, int, int, double, Size, bool)

Create a video writer using the specific information

public VideoWriter(string fileName, int apiPreference, int compressionCode, double fps, Size size, bool isColor)

Parameters

fileName string

The name of the video file to be written to

apiPreference int

Allows to specify API backends to use. Use 0 if you don't have any preference.

compressionCode int

Compression code. Usually computed using CvInvoke.CV_FOURCC. On windows use -1 to open a codec selection dialog. On Linux, use CvInvoke.CV_FOURCC('I', 'Y', 'U', 'V') for default codec for the specific file name.

fps double

frame rate per second

size Size

the size of the frame

isColor bool

true if this is a color video, false otherwise

VideoWriter(string, int, int, double, Size, params Tuple<WriterProperty, int>[])

Create a video writer using the specific information

public VideoWriter(string fileName, int apiPreference, int compressionCode, double fps, Size size, params Tuple<VideoWriter.WriterProperty, int>[] writerProperties)

Parameters

fileName string

The name of the video file to be written to

apiPreference int

Allows to specify API backends to use. Use 0 if you don't have any specific preference.

compressionCode int

Compression code. Usually computed using CvInvoke.CV_FOURCC. On windows use -1 to open a codec selection dialog. On Linux, use VideoWriter.Fourcc('I', 'Y', 'U', 'V') for default codec for the specific file name.

fps double

Frame rate per second

size Size

The size of the frame

writerProperties Tuple<WriterProperty, int>[]

Optional writer properties. e.g. new Tuple<VideoWriter.WriterProperty>(VideoWriter.WriterProperty.HwAcceleration, (int) VideoAccelerationType.Any)

Properties

BackendName

The name of the backend used by this VideoWriter

public string BackendName { get; }

Property Value

string

IsOpened

Returns true if video writer has been successfully initialized.

public bool IsOpened { get; }

Property Value

bool

Methods

DisposeObject()

Release the video writer and all the memory associate with it

protected override void DisposeObject()

Fourcc(char, char, char, char)

Generate 4-character code of codec used to compress the frames. For example, CV_FOURCC('P','I','M','1') is MPEG-1 codec, CV_FOURCC('M','J','P','G') is motion-jpeg codec etc.

public static int Fourcc(char c1, char c2, char c3, char c4)

Parameters

c1 char

C1

c2 char

C2

c3 char

C3

c4 char

C4

Returns

int

The integer value calculated from the four cc code

Get(WriterProperty)

Returns the specified VideoWriter property.

public double Get(VideoWriter.WriterProperty prop)

Parameters

prop VideoWriter.WriterProperty

Property identifier.

Returns

double

The value of the specific property

Set(WriterProperty, double)

Sets a property in the VideoWriter.

public bool Set(VideoWriter.WriterProperty prop, double value)

Parameters

prop VideoWriter.WriterProperty

Property identifier

value double

Value of the property.

Returns

bool

The value of the specific property

Write(IInputArray)

Write a single frame to the video writer

public void Write(IInputArray frame)

Parameters

frame IInputArray

The frame to be written to the video writer