Module Opencv.Video_writer
val video_writer1 : unit -> tUsage:
video_writer1 ()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.
val video_writer2 : ?is_color:bool -> string -> int -> float -> size2i -> tUsage:
video_writer2 ?is_color filename fourcc fps frame_size- Parameter:
filename: Name of the output video file. - Parameter:
fourcc: 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 atVideo Codecs by FOURCC(http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses other values as fourcc code: seeObjectType(http://mp4ra.org/#/codecs), so you may receive a warning message from OpenCV about fourcc code conversion. - Parameter:
fps: Framerate of the created video stream. - Parameter:
frame_size: Size of the video frames. - Parameter:
is_color: If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames.
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.
- Parameter:
val video_writer3 : ?is_color:bool -> string -> int -> int -> float -> size2i -> tUsage:
video_writer3 ?is_color filename api_preference fourcc fps frame_sizeThe
apiPreferenceparameter 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.
val video_writer4 : string -> int -> float -> size2i -> int list -> tUsage:
video_writer4 filename fourcc fps frame_size params* The
paramsparameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) * see cv::VideoWriterProperties
val video_writer5 : string -> int -> int -> float -> size2i -> int list -> tUsage:
video_writer5 filename api_preference fourcc fps frame_size params
val open1 : ?is_color:bool -> t -> string -> int -> float -> size2i -> boolUsage:
open1 ?is_color __self filename fourcc fps frame_sizeInitializes or reinitializes video writer.
The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.
- Returns:
trueif video writer has been successfully initialized
The method first calls VideoWriter::release to close the already opened file.
- Returns:
val open2 : ?is_color:bool -> t -> string -> int -> int -> float -> size2i -> boolUsage:
open2 ?is_color __self filename api_preference fourcc fps frame_size
val open3 : t -> string -> int -> float -> size2i -> int list -> boolUsage:
open3 __self filename fourcc fps frame_size params
val open4 : t -> string -> int -> int -> float -> size2i -> int list -> boolUsage:
open4 __self filename api_preference fourcc fps frame_size params
val is_opened : t -> boolUsage:
is_opened __selfReturns true if video writer has been successfully initialized.
val release : t -> unitUsage:
release __selfCloses the video writer.
The method is automatically called by subsequent VideoWriter::open and by the VideoWriter destructor.
val write : t -> Cvdata.t -> unitUsage:
write __self imageWrites the next video frame
- Parameter:
image: 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.
- Parameter:
val set : t -> int -> float -> boolUsage:
set __self prop_id valueSets a property in the VideoWriter.
- Parameter:
prop_id: Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of videoio_flags_others
- Parameter:
value: Value of the property. - Returns:
trueif the property is supported by the backend used by the VideoWriter instance.
- Parameter:
val get : t -> int -> floatUsage:
get __self prop_idReturns the specified VideoWriter property
- Parameter:
prop_id: Property identifier from cv::VideoWriterProperties (eg. cv::VIDEOWRITER_PROP_QUALITY) or one of videoio_flags_others
- Returns: 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.
- Parameter:
val fourcc : char -> char -> char -> char -> intUsage:
fourcc c1 c2 c3 c4Concatenates 4 chars to a fourcc code
- Returns: a fourcc code
This static method constructs the fourcc code of the codec to be used in the constructor VideoWriter::VideoWriter or VideoWriter::open.
val get_backend_name : t -> stringUsage:
get_backend_name __selfReturns used backend API name
Note: Stream should be opened.