Unable to save video file from camera

asked 2019-04-09 03:12:08 -0500

vps gravatar image

Dear all, I am trying to save the greyscale video from the camera but the output video file size is only 5 kb and it is not playable. Does anyone have an idea about this? below is the code snippet. Thanks.

Size frameSize(static_cast<int>(dWidth), static_cast<int>(dHeight)); VideoWriter leftVideoWriter("left.avi", CV_FOURCC('P', 'I', 'M', '1'), 20, frameSize, false); VideoWriter rightVideoWriter("right.avi", CV_FOURCC('P', 'I', 'M', '1'), 20, frameSize, false);

if (!capture.read(frame[0], frame[1]))

edit retag flag offensive close merge delete


Try to debug: set environment variable OPENCV_VIDEOIO_DEBUG=1

Try to lock backend: VideoWriter(filename, CAP_FFMPEG, ...)(https://docs.opencv.org/4.1.0/dd/d9e/...)

mshabunin gravatar imagemshabunin ( 2019-04-09 07:23:48 -0500 )edit

It is working when I have installed a proper fourcc codec.

vps gravatar imagevps ( 2019-04-10 03:16:57 -0500 )edit