Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV 3.1 VideoWriter::write(const Mat&) does not return its status.

Hello, I found it strange that the "VideoWriter::write(const Mat&)" function does not return its status (true/false).

I think that function should return an int to inform about the result of the call. (true (success) / false (fail))

The function declaration could be changed to: "virtual int write (const Mat &image)" instead of "virtual void write (const Mat &image)"

It would be easy to return the status because the source code inside write is using "cvWriteFrame(writer, &_img);" which returns an integer.

See definition and source here:

void VideoWriter::write(const Mat& image)
    if( iwriter )
        IplImage _img = image;
        cvWriteFrame(writer, &_img);

Otherwise, how can we know the status of the write call ?
(For example: it could fail because of the drive is full or there is a problem with the encoder or the storage device has been removed)

If my comment is relevant, where should I request that change ?