Why do I have the following error when using videoWriter.write()?

asked 2017-03-08 04:02:50 -0600

yxchng gravatar image

OpenCV Error: Assertion failed (image->depth == 8) in writeFrame, file /home/yxchng/OpenCV/modules/videoio/src/cap_ffmpeg.cpp, line 272

However, i am able to use imwrite() to write each frame.

Can I know how I can solve this problem?

edit retag flag offensive close merge delete

Comments

Your image depth does not seem to fit. videoWriter.write() supports only 8bit images. If you store a .png or .tiff image with imwrite() 16bit images are supported, too. You could convert your image before using videoWriter.

cv::Mat image, image8Bit;
image.convertTo(image8Bit, CV_8U);
matman gravatar imagematman ( 2017-03-08 12:09:45 -0600 )edit