Struct opencv::videoio::VideoWriter [−][src]
Video writer class.
The class provides C++ API for writing video files or image sequences.
Implementations
impl VideoWriter[src]
pub fn as_raw_VideoWriter(&self) -> *const c_void[src]
pub fn as_raw_mut_VideoWriter(&mut self) -> *mut c_void[src]
impl VideoWriter[src]
pub fn default() -> Result<VideoWriter>[src]
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.
pub fn new(
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<VideoWriter>[src]
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<VideoWriter>
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.
Overloaded parameters
Parameters
-
filename: Name of the output video file.
-
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 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: Framerate of the created video stream.
-
frameSize: Size of the video frames.
-
isColor: If it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames.
@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.
- With some backends
C++ default parameters
- is_color: true
pub fn new_with_backend(
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<VideoWriter>[src]
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<VideoWriter>
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.
Overloaded parameters
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.
C++ default parameters
- is_color: true
pub fn new_1(
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<VideoWriter>[src]
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<VideoWriter>
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.
Overloaded parameters
* The `params` parameter allows to specify extra encoder parameters encoded as pairs (paramId_1, paramValue_1, paramId_2, paramValue_2, ... .) * see cv::VideoWriterProperties
pub fn new_2(
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<VideoWriter>[src]
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<VideoWriter>
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.
Overloaded parameters
pub fn fourcc(c1: i8, c2: i8, c3: i8, c4: i8) -> Result<i32>[src]
Concatenates 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.
Trait Implementations
impl Boxed for VideoWriter[src]
unsafe fn from_raw(ptr: *mut c_void) -> Self[src]
fn into_raw(self) -> *mut c_void[src]
fn as_raw(&self) -> *const c_void[src]
fn as_raw_mut(&mut self) -> *mut c_void[src]
impl Drop for VideoWriter[src]
impl Send for VideoWriter[src]
impl VideoWriterTrait for VideoWriter[src]
fn as_raw_VideoWriter(&self) -> *const c_void[src]
fn as_raw_mut_VideoWriter(&mut self) -> *mut c_void[src]
fn open(
&mut self,
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<bool>[src]
&mut self,
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<bool>
fn open_with_backend(
&mut self,
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<bool>[src]
&mut self,
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
is_color: bool
) -> Result<bool>
fn open_1(
&mut self,
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<bool>[src]
&mut self,
filename: &str,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<bool>
fn open_2(
&mut self,
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<bool>[src]
&mut self,
filename: &str,
api_preference: i32,
fourcc: i32,
fps: f64,
frame_size: Size,
params: &Vector<i32>
) -> Result<bool>
fn is_opened(&self) -> Result<bool>[src]
fn release(&mut self) -> Result<()>[src]
fn write(&mut self, image: &dyn ToInputArray) -> Result<()>[src]
fn set(&mut self, prop_id: i32, value: f64) -> Result<bool>[src]
fn get(&self, prop_id: i32) -> Result<f64>[src]
fn get_backend_name(&self) -> Result<String>[src]
Auto Trait Implementations
impl RefUnwindSafe for VideoWriter
impl !Sync for VideoWriter
impl Unpin for VideoWriter
impl UnwindSafe for VideoWriter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,