Ask Your Question

Writing raw video using VideoWriter

asked 2019-12-12 09:18:36 -0500

mikeiz gravatar image

I want to write a video file as a raw AVI and have not been successful using VideoWriter. I can write a video file using

fourcc = cv::VideoWriter::fourcc('3', 'I', 'V', 'D')

I've tried other fourcc codes for raw video from the list at ff_codec_movvideo_tags I've also tried setting fourcc and fps to 0, but that caused an error.

VideoWriter video;
fourcc = 0;
if (!, fourcc, fps, Size(w, h)))
    return -1;

The open returns o and the program ends with return -1. I would appreciate any help in the code I need to write a raw file. I'm using OpenCV 4.1.1

edit retag flag offensive close merge delete


Change this:

fourcc = 0;


fourcc =cv.CV_FOURCC( '3', 'I', 'V', 'D');


fps = 0;


fps = 25.0;

w =320; h = 120;

supra56 gravatar imagesupra56 ( 2019-12-12 12:07:29 -0500 )edit

This does not create a raw video file. This creates a compressed MPEG-4 file.

mikeiz gravatar imagemikeiz ( 2019-12-12 14:14:48 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-12-12 14:51:19 -0500

LBerger gravatar image

updated 2019-12-12 14:52:08 -0500

try fourcc = cv.VideoWriter_fourcc(*'RGBA')

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-12-12 09:18:36 -0500

Seen: 399 times

Last updated: Dec 12 '19