Ask Your Question
0

Writing raw video using VideoWriter

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

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;
fps=0;
if (!video.open(rec, 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

Comments

Change this:

fourcc = 0;

to:

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

And:

fps = 0;

to:

fps = 25.0;

w =320; h = 120;

supra56 gravatar imagesupra56 ( 2019-12-12 12:07:29 -0600 )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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

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

LBerger gravatar image

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

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 4,265 times

Last updated: Dec 12 '19