View Source Evision.VideoWriter (Evision v0.1.8)

Link to this section Summary

cv

Concatenates 4 chars to a fourcc code

Returns the specified VideoWriter property

Returns used backend API name

Returns true if video writer has been successfully initialized.

Initializes or reinitializes video writer.

Variant 1:

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Variant 1:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Closes the video writer.

Sets a property in the VideoWriter.

Default constructors

Positional Arguments

Variant 1:

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Variant 1:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Writes the next video frame

Link to this section cv

Concatenates 4 chars to a fourcc code

Positional Arguments
  • c1: char
  • c2: char
  • c3: char
  • c4: char

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

Python prototype (for reference):

fourcc(c1, c2, c3, c4) -> retval

Returns the specified VideoWriter property

Positional Arguments
  • propId: int.

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

@return 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.

Python prototype (for reference):

get(propId) -> retval

Returns used backend API name

Note: Stream should be opened.

Python prototype (for reference):

getBackendName() -> retval

Returns true if video writer has been successfully initialized.

Python prototype (for reference):

isOpened() -> retval
Link to this function

open(self, filename, fourcc, fps, frameSize)

View Source

Initializes or reinitializes video writer.

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter. @return true if video writer has been successfully initialized The method first calls VideoWriter::release to close the already opened file.

Python prototype (for reference):

open(filename, fourcc, fps, frameSize[, isColor]) -> retval
Link to this function

open(self, filename, fourcc, fps, frameSize, opts)

View Source

Variant 1:

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Python prototype (for reference):

open(filename, fourcc, fps, frameSize, params) -> retval

Variant 2:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

Has overloading in C++

Python prototype (for reference):

open(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> retval

Variant 3:

Initializes or reinitializes video writer.

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter. @return true if video writer has been successfully initialized The method first calls VideoWriter::release to close the already opened file.

Python prototype (for reference):

open(filename, fourcc, fps, frameSize[, isColor]) -> retval
Link to this function

open(self, filename, apiPreference, fourcc, fps, frameSize, opts)

View Source

Variant 1:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Python prototype (for reference):

open(filename, apiPreference, fourcc, fps, frameSize, params) -> retval

Variant 2:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

Has overloading in C++

Python prototype (for reference):

open(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> retval

Closes the video writer.

The method is automatically called by subsequent VideoWriter::open and by the VideoWriter destructor.

Python prototype (for reference):

release() -> None
Link to this function

set(self, propId, value)

View Source

Sets a property in the VideoWriter.

Positional Arguments
  • propId: int.

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

  • value: double.

    Value of the property.

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

Python prototype (for reference):

set(propId, value) -> retval

Default constructors

The constructors/functions initialize video writers.

  • On Linux FFMPEG is used to write videos;
  • On Windows FFMPEG or MSWF or DSHOW is used;
  • On MacOSX AVFoundation is used.

Python prototype (for reference):

VideoWriter() -> <VideoWriter object>
Link to this function

videoWriter(filename, fourcc, fps, frameSize)

View Source
Positional Arguments
  • filename: String.

    Name of the output video file.

  • fourcc: int.

    4-character code of codec used to compress the frames. For example, VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a motion-jpeg codec etc. List of codes can be obtained at Video Codecs by FOURCC page. FFMPEG backend with MP4 container natively uses other values as fourcc code: see ObjectType, so you may receive a warning message from OpenCV about fourcc code conversion.

  • fps: double.

    Framerate of the created video stream.

  • frameSize: Size.

    Size of the video frames.

Keyword Arguments
  • isColor: bool.

    If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames.

Has overloading in C++

@b Tips:

  • With some backends fourcc=-1 pops up the codec selection dialog from the system.

  • To save image sequence use a proper filename (eg. img_%02d.jpg) and fourcc=0 OR fps=0. Use uncompressed image format (eg. img_%02d.BMP) to save raw frames.

  • Most codecs are lossy. If you want lossless video file you need to use a lossless codecs (eg. FFMPEG FFV1, Huffman HFYU, Lagarith LAGS, etc...)

  • If FFMPEG is enabled, using codec=0; fps=0; you can create an uncompressed (raw) video file.

Python prototype (for reference):

VideoWriter(filename, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>
Link to this function

videoWriter(filename, fourcc, fps, frameSize, opts)

View Source

Variant 1:

Positional Arguments
  • filename: String
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

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

Python prototype (for reference):

VideoWriter(filename, fourcc, fps, frameSize, params) -> <VideoWriter object>

Variant 2:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

Has overloading in C++

The apiPreference parameter 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.

Python prototype (for reference):

VideoWriter(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>

Variant 3:

Positional Arguments
  • filename: String.

    Name of the output video file.

  • fourcc: int.

    4-character code of codec used to compress the frames. For example, VideoWriter::fourcc('P','I','M','1') is a MPEG-1 codec, VideoWriter::fourcc('M','J','P','G') is a motion-jpeg codec etc. List of codes can be obtained at Video Codecs by FOURCC page. FFMPEG backend with MP4 container natively uses other values as fourcc code: see ObjectType, so you may receive a warning message from OpenCV about fourcc code conversion.

  • fps: double.

    Framerate of the created video stream.

  • frameSize: Size.

    Size of the video frames.

Keyword Arguments
  • isColor: bool.

    If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames.

Has overloading in C++

@b Tips:

  • With some backends fourcc=-1 pops up the codec selection dialog from the system.

  • To save image sequence use a proper filename (eg. img_%02d.jpg) and fourcc=0 OR fps=0. Use uncompressed image format (eg. img_%02d.BMP) to save raw frames.

  • Most codecs are lossy. If you want lossless video file you need to use a lossless codecs (eg. FFMPEG FFV1, Huffman HFYU, Lagarith LAGS, etc...)

  • If FFMPEG is enabled, using codec=0; fps=0; you can create an uncompressed (raw) video file.

Python prototype (for reference):

VideoWriter(filename, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>
Link to this function

videoWriter(filename, apiPreference, fourcc, fps, frameSize, opts)

View Source

Variant 1:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
  • params: [int]

Has overloading in C++

Python prototype (for reference):

VideoWriter(filename, apiPreference, fourcc, fps, frameSize, params) -> <VideoWriter object>

Variant 2:

Positional Arguments
  • filename: String
  • apiPreference: int
  • fourcc: int
  • fps: double
  • frameSize: Size
Keyword Arguments
  • isColor: bool.

Has overloading in C++

The apiPreference parameter 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.

Python prototype (for reference):

VideoWriter(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>

Writes the next video frame

Positional Arguments
  • image: Evision.Mat.

    The written frame. In general, color images are expected in BGR format.

The function/method writes the specified image to video file. It must have the same size as has been specified when opening the video writer.

Python prototype (for reference):

write(image) -> None

Link to this section Functions

Raising version of fourcc/4.

Raising version of get/2.

Raising version of getBackendName/1.

Raising version of isOpened/1.

Link to this function

open!(self, filename, fourcc, fps, frameSize)

View Source

Raising version of open/5.

Link to this function

open!(self, filename, fourcc, fps, frameSize, params)

View Source

Raising version of open/6.

Link to this function

open!(self, filename, apiPreference, fourcc, fps, frameSize, params)

View Source

Raising version of open/7.

Raising version of release/1.

Link to this function

set!(self, propId, value)

View Source

Raising version of set/3.

Raising version of videoWriter/0.

Link to this function

videoWriter!(filename, fourcc, fps, frameSize)

View Source

Raising version of videoWriter/4.

Link to this function

videoWriter!(filename, fourcc, fps, frameSize, params)

View Source

Raising version of videoWriter/5.

Link to this function

videoWriter!(filename, apiPreference, fourcc, fps, frameSize, params)

View Source

Raising version of videoWriter/6.

Raising version of write/2.