Show / Hide Table of Contents

Class VideoWriter

AVI Video File Writer

Inheritance
System.Object
DisposableObject
DisposableCvObject
VideoWriter
Implements
ICvPtrHolder
Inherited Members
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.DisposeManaged()
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class VideoWriter : DisposableCvObject, ICvPtrHolder

Constructors

| Improve this Doc View Source

VideoWriter()

Declaration
public VideoWriter()
| Improve this Doc View Source

VideoWriter(String, FourCC, Double, Size, VideoWriterPara)

Creates video writer structure.

Declaration
public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, VideoWriterPara prms)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

VideoWriterPara prms

Parameters of VideoWriter for hardware acceleration

| Improve this Doc View Source

VideoWriter(String, FourCC, Double, Size, Boolean)

Creates video writer structure.

Declaration
public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Boolean isColor

If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).

| Improve this Doc View Source

VideoWriter(String, FourCC, Double, Size, Int32[])

Creates video writer structure.

Declaration
public VideoWriter(string fileName, FourCC fourcc, double fps, Size frameSize, int[] prms)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Int32[] prms

The params parameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::VideoWriterProperties

| Improve this Doc View Source

VideoWriter(String, VideoCaptureAPIs, FourCC, Double, Size, VideoWriterPara)

Creates video writer structure.

Declaration
public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, VideoWriterPara prms)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

VideoCaptureAPIs apiPreference

allows to specify API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

VideoWriterPara prms

Parameters of VideoWriter for hardware acceleration

| Improve this Doc View Source

VideoWriter(String, VideoCaptureAPIs, FourCC, Double, Size, Boolean)

Creates video writer structure.

Declaration
public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

VideoCaptureAPIs apiPreference

allows to specify API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Boolean isColor

If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).

| Improve this Doc View Source

VideoWriter(String, VideoCaptureAPIs, FourCC, Double, Size, Int32[])

Creates video writer structure.

Declaration
public VideoWriter(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, int[] prms)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

VideoCaptureAPIs apiPreference

allows to specify API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Int32[] prms

The params parameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) see cv::VideoWriterProperties

Properties

| Improve this Doc View Source

FileName

Get output video file name

Declaration
public string FileName { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Fps

Frames per second of the output video

Declaration
public double Fps { get; }
Property Value
Type Description
System.Double
| Improve this Doc View Source

FrameSize

Get size of frame image

Declaration
public Size FrameSize { get; }
Property Value
Type Description
OpenCvSharp.Size
| Improve this Doc View Source

IsColor

Get whether output frames is color or not

Declaration
public bool IsColor { get; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

DisposeUnmanaged()

Releases unmanaged resources

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

FourCC(Char, Char, Char, Char)

Concatenates 4 chars to a fourcc code. This static method constructs the fourcc code of the codec to be used in the constructor VideoWriter::VideoWriter or VideoWriter::open.

Declaration
public static int FourCC(char c1, char c2, char c3, char c4)
Parameters
Type Name Description
System.Char c1
System.Char c2
System.Char c3
System.Char c4
Returns
Type Description
System.Int32
| Improve this Doc View Source

FourCC(String)

Concatenates 4 chars to a fourcc code. This static method constructs the fourcc code of the codec to be used in the constructor VideoWriter::VideoWriter or VideoWriter::open.

Declaration
public static int FourCC(string code)
Parameters
Type Name Description
System.String code
Returns
Type Description
System.Int32
| Improve this Doc View Source

Get(VideoWriterProperties)

Returns the specified VideoWriter property

Declaration
public double Get(VideoWriterProperties propId)
Parameters
Type Name Description
VideoWriterProperties propId

Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others

Returns
Type Description
System.Double

Value for the specified property. Value 0 is returned when querying a property that is not supported by the backend used by the VideoWriter instance.

| Improve this Doc View Source

GetBackendName()

Returns used backend API name. Note that stream should be opened.

Declaration
public string GetBackendName()
Returns
Type Description
System.String
| Improve this Doc View Source

IsOpened()

Returns true if video writer has been successfully initialized.

Declaration
public bool IsOpened()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Open(String, FourCC, Double, Size, Boolean)

Creates video writer structure.

Declaration
public bool Open(string fileName, FourCC fourcc, double fps, Size frameSize, bool isColor = true)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Boolean isColor

If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Open(String, VideoCaptureAPIs, FourCC, Double, Size, Boolean)

Creates video writer structure.

Declaration
public bool Open(string fileName, VideoCaptureAPIs apiPreference, FourCC fourcc, double fps, Size frameSize, bool isColor = true)
Parameters
Type Name Description
System.String fileName

Name of the output video file.

VideoCaptureAPIs apiPreference

allows to specify API backends to use. Can be used to enforce a specific reader implementation if multiple are available: e.g. cv::CAP_FFMPEG or cv::CAP_GSTREAMER.

FourCC fourcc

4-character code of codec used to compress the frames. For example, "PIM1" is MPEG-1 codec, "MJPG" is motion-jpeg codec etc. Under Win32 it is possible to pass null in order to choose compression method and additional compression parameters from dialog.

System.Double fps

Frame rate of the created video stream.

OpenCvSharp.Size frameSize

Size of video frames.

System.Boolean isColor

If it is true, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).

Returns
Type Description
System.Boolean
| Improve this Doc View Source

Release()

Declaration
public void Release()
| Improve this Doc View Source

Set(VideoWriterProperties, Double)

Sets a property in the VideoWriter.

Declaration
public bool Set(VideoWriterProperties propId, double value)
Parameters
Type Name Description
VideoWriterProperties propId

Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others

System.Double value

Value of the property.

Returns
Type Description
System.Boolean

true if the property is supported by the backend used by the VideoWriter instance.

| Improve this Doc View Source

Write(InputArray)

Writes/appends one frame to video file.

Declaration
public void Write(InputArray image)
Parameters
Type Name Description
InputArray image

the written frame.

Implements

ICvPtrHolder
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX