opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

VideoWriter Class Reference

Video writer class. More...

#include <videoio.hpp>

Public Member Functions

CV_WRAP VideoWriter ()
 VideoWriter constructors.
CV_WRAP VideoWriter (const String &filename, int fourcc, double fps, Size frameSize, bool isColor=true)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
virtual CV_WRAP bool open (const String &filename, int fourcc, double fps, Size frameSize, bool isColor=true)
 Initializes or reinitializes video writer.
virtual CV_WRAP bool isOpened () const
 Returns true if video writer has been successfully initialized.
virtual CV_WRAP void release ()
 Closes the video writer.
virtual CV_WRAP void write (const Mat &image)
 Writes the next video frame.
virtual CV_WRAP bool set (int propId, double value)
 Sets a property in the VideoWriter.
virtual CV_WRAP double get (int propId) const
 Returns the specified VideoWriter property.

Static Public Member Functions

static CV_WRAP int fourcc (char c1, char c2, char c3, char c4)
 Concatenates 4 chars to a fourcc code.

Detailed Description

Video writer class.

Definition at line 580 of file videoio.hpp.


Constructor & Destructor Documentation

CV_WRAP VideoWriter (  )

VideoWriter constructors.

The constructors/functions initialize video writers. On Linux FFMPEG is used to write videos; on Windows FFMPEG or VFW is used; on MacOSX QTKit is used.

CV_WRAP VideoWriter ( const String &  filename,
int  fourcc,
double  fps,
Size  frameSize,
bool  isColor = true 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
filenameName of the output video file.
fourcc4-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](http://www.fourcc.org/codecs.php) page. FFMPEG backend with MP4 container natively uses other values as fourcc code: see [ObjectType](http://www.mp4ra.org/codecs.html), so you may receive a warning message from OpenCV about fourcc code conversion.
fpsFramerate of the created video stream.
frameSizeSize of the video frames.
isColorIf it is not zero, the encoder will expect and encode color frames, otherwise it will work with grayscale frames (the flag is currently supported on Windows only).

Member Function Documentation

static CV_WRAP int fourcc ( char  c1,
char  c2,
char  c3,
char  c4 
) [static]

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.

virtual CV_WRAP double get ( int  propId ) const [virtual]

Returns the specified VideoWriter property.

Parameters:
propIdProperty identifier. It can be one of the following:

  • **VIDEOWRITER_PROP_QUALITY** Current quality of the encoded videostream.
  • **VIDEOWRITER_PROP_FRAMEBYTES** (Read-only) Size of just encoded video frame; note that the encoding order may be different from representation order.
  • **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
Note:
When querying a property that is not supported by the backend used by the VideoWriter class, value 0 is returned.
virtual CV_WRAP bool isOpened (  ) const [virtual]

Returns true if video writer has been successfully initialized.

virtual CV_WRAP bool open ( const String &  filename,
int  fourcc,
double  fps,
Size  frameSize,
bool  isColor = true 
) [virtual]

Initializes or reinitializes video writer.

The method opens video writer. Parameters are the same as in the constructor VideoWriter::VideoWriter.

virtual CV_WRAP void release (  ) [virtual]

Closes the video writer.

The methods are automatically called by subsequent VideoWriter::open and by the VideoWriter destructor.

virtual CV_WRAP bool set ( int  propId,
double  value 
) [virtual]

Sets a property in the VideoWriter.

Parameters:
propIdProperty identifier. It can be one of the following:

  • **VIDEOWRITER_PROP_QUALITY** Quality (0..100%) of the videostream encoded. Can be adjusted dynamically in some codecs.
  • **VIDEOWRITER_PROP_NSTRIPES** Number of stripes for parallel encoding
valueValue of the property.
virtual CV_WRAP void write ( const Mat image ) [virtual]

Writes the next video frame.

Parameters:
imageThe written frame

The functions/methods write the specified image to video file. It must have the same size as has been specified when opening the video writer.