View Source Evision.VideoWriter (Evision v1.0.0-rc.0)
Summary
Functions
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:
open
Closes the video writer.
Sets a property in the VideoWriter.
Default constructors
VideoWriter
Variant 1:
VideoWriter
Variant 1:
VideoWriter
Writes the next video frame
Types
@type t() :: %Evision.VideoWriter{ref: reference()}
Type that represents an VideoWriter struct.
ref.
reference()The underlying erlang resource variable.
Functions
Concatenates 4 chars to a fourcc code
Positional Arguments
- c1:
char - c2:
char - c3:
char - c4:
char
Return
- retval:
integer()
@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 only):
fourcc(c1, c2, c3, c4) -> retval
Returns the specified VideoWriter property
Positional Arguments
self:
Evision.VideoWriter.t()propId:
integer().Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others
Return
- retval:
double
@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 only):
get(propId) -> retval
@spec getBackendName(Keyword.t()) :: any() | {:error, String.t()}
@spec getBackendName(t()) :: binary() | {:error, String.t()}
Returns used backend API name
Positional Arguments
- self:
Evision.VideoWriter.t()
Return
- retval:
String
Note: Stream should be opened.
Python prototype (for reference only):
getBackendName() -> retval
@spec isOpened(Keyword.t()) :: any() | {:error, String.t()}
@spec isOpened(t()) :: boolean() | {:error, String.t()}
Returns true if video writer has been successfully initialized.
Positional Arguments
- self:
Evision.VideoWriter.t()
Return
- retval:
bool
Python prototype (for reference only):
isOpened() -> retval
@spec open(t(), binary(), integer(), number(), {number(), number()}) :: boolean() | {:error, String.t()}
Initializes or reinitializes video writer.
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- retval:
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 only):
open(filename, fourcc, fps, frameSize[, isColor]) -> retval
@spec open( t(), binary(), integer(), number(), {number(), number()}, [{:isColor, term()}] | nil ) :: boolean() | {:error, String.t()}
@spec open(t(), binary(), integer(), number(), {number(), number()}, [integer()]) :: boolean() | {:error, String.t()}
@spec open(t(), binary(), integer(), integer(), number(), {number(), number()}) :: boolean() | {:error, String.t()}
Variant 1:
open
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - fourcc:
integer() - fps:
double - frameSize:
Size - params:
[integer()]
Return
- retval:
bool
Has overloading in C++
Python prototype (for reference only):
open(filename, fourcc, fps, frameSize, params) -> retvalVariant 2:
open
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- retval:
bool
Has overloading in C++
Python prototype (for reference only):
open(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> retvalVariant 3:
Initializes or reinitializes video writer.
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- retval:
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 only):
open(filename, fourcc, fps, frameSize[, isColor]) -> retval
@spec open( t(), binary(), integer(), integer(), number(), {number(), number()}, [{:isColor, term()}] | nil ) :: boolean() | {:error, String.t()}
@spec open(t(), binary(), integer(), integer(), number(), {number(), number()}, [ integer() ]) :: boolean() | {:error, String.t()}
Variant 1:
open
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size - params:
[integer()]
Return
- retval:
bool
Has overloading in C++
Python prototype (for reference only):
open(filename, apiPreference, fourcc, fps, frameSize, params) -> retvalVariant 2:
open
Positional Arguments
- self:
Evision.VideoWriter.t() - filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- retval:
bool
Has overloading in C++
Python prototype (for reference only):
open(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> retval
@spec release(Keyword.t()) :: any() | {:error, String.t()}
@spec release(t()) :: t() | {:error, String.t()}
Closes the video writer.
Positional Arguments
- self:
Evision.VideoWriter.t()
The method is automatically called by subsequent VideoWriter::open and by the VideoWriter destructor.
Python prototype (for reference only):
release() -> None
Sets a property in the VideoWriter.
Positional Arguments
self:
Evision.VideoWriter.t()propId:
integer().Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of @ref videoio_flags_others
value:
double.Value of the property.
Return
- retval:
bool
@return true if the property is supported by the backend used by the VideoWriter instance.
Python prototype (for reference only):
set(propId, value) -> retval
Default constructors
Return
- self:
Evision.VideoWriter.t()
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 only):
VideoWriter() -> <VideoWriter object>
@spec videoWriter(binary(), integer(), number(), {number(), number()}) :: t() | {:error, String.t()}
VideoWriter
Positional Arguments
filename:
String.Name of the output video file.
fourcc:
integer().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 MSDN page or with this page of the fourcc site for a more complete list). 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.
Return
- self:
Evision.VideoWriter.t()
Has overloading in C++
@b Tips:
With some backends
fourcc=-1pops up the codec selection dialog from the system.To save image sequence use a proper filename (eg.
img_%02d.jpg) andfourcc=0ORfps=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.If FFMPEG is used, we allow frames of odd width or height, but in this case we truncate the rightmost column/the bottom row. Probably, this should be handled more elegantly, but some internal functions inside FFMPEG swscale require even width/height.
Python prototype (for reference only):
VideoWriter(filename, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>
@spec videoWriter( binary(), integer(), number(), {number(), number()}, [{:isColor, term()}] | nil ) :: t() | {:error, String.t()}
@spec videoWriter(binary(), integer(), number(), {number(), number()}, [integer()]) :: t() | {:error, String.t()}
@spec videoWriter(binary(), integer(), integer(), number(), {number(), number()}) :: t() | {:error, String.t()}
Variant 1:
VideoWriter
Positional Arguments
- filename:
String - fourcc:
integer() - fps:
double - frameSize:
Size - params:
[integer()]
Return
- self:
Evision.VideoWriter.t()
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 only):
VideoWriter(filename, fourcc, fps, frameSize, params) -> <VideoWriter object>Variant 2:
VideoWriter
Positional Arguments
- filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- self:
Evision.VideoWriter.t()
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 only):
VideoWriter(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>Variant 3:
VideoWriter
Positional Arguments
filename:
String.Name of the output video file.
fourcc:
integer().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 MSDN page or with this page of the fourcc site for a more complete list). 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.
Return
- self:
Evision.VideoWriter.t()
Has overloading in C++
@b Tips:
With some backends
fourcc=-1pops up the codec selection dialog from the system.To save image sequence use a proper filename (eg.
img_%02d.jpg) andfourcc=0ORfps=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.If FFMPEG is used, we allow frames of odd width or height, but in this case we truncate the rightmost column/the bottom row. Probably, this should be handled more elegantly, but some internal functions inside FFMPEG swscale require even width/height.
Python prototype (for reference only):
VideoWriter(filename, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>
videoWriter(filename, apiPreference, fourcc, fps, frameSize, opts)
View Source@spec videoWriter( binary(), integer(), integer(), number(), {number(), number()}, [{:isColor, term()}] | nil ) :: t() | {:error, String.t()}
@spec videoWriter(binary(), integer(), integer(), number(), {number(), number()}, [ integer() ]) :: t() | {:error, String.t()}
Variant 1:
VideoWriter
Positional Arguments
- filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size - params:
[integer()]
Return
- self:
Evision.VideoWriter.t()
Has overloading in C++
Python prototype (for reference only):
VideoWriter(filename, apiPreference, fourcc, fps, frameSize, params) -> <VideoWriter object>Variant 2:
VideoWriter
Positional Arguments
- filename:
String - apiPreference:
integer() - fourcc:
integer() - fps:
double - frameSize:
Size
Keyword Arguments
- isColor:
bool.
Return
- self:
Evision.VideoWriter.t()
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 only):
VideoWriter(filename, apiPreference, fourcc, fps, frameSize[, isColor]) -> <VideoWriter object>
@spec write(t(), Evision.Mat.maybe_mat_in()) :: boolean() | {:error, String.t()}
Writes the next video frame
Positional Arguments
self:
Evision.VideoWriter.t()image:
Evision.Mat.The written frame. In general, color images are expected in BGR format.
Return
- retval:
bool
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.
@return true if the frame was written successfully by the underlying backend,
false otherwise (for example, on network errors when streaming, encoder failures,
or unsupported input frames). Backends that do not surface per-frame status from
their native API report true on best-effort success.
Python prototype (for reference only):
write(image) -> retval