Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Short answer: better codec is the way!

You could use codec like DivX/mpeg

// High compression rate lossy image quality
int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

or lossless codec like Lagarith or FFV1

// Lossless in quality with good processing performance
int codec = cv::VideoWriter::fourcc('L', 'A', 'G', 'S');

Finally you could try some codec designed for screen capture like TechSmith or iSCC or something else

Some codec has some limitation about frame size (odd,even, 4x,..) and/or frame format (RGB,YV2/12,...)

The codec need to be installed in your computer and in the computer where the resulting video will played. Finally your need to link the opencv_ffmpeg library and deploy the related opencv_ffmpeg DLL

Short answer: better codec is the way!way.

You could use codec like DivX/mpeg

// High compression rate lossy image quality
int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

or lossless codec like Lagarith or FFV1

// Lossless in quality with good processing performance
int codec = cv::VideoWriter::fourcc('L', 'A', 'G', 'S');

Finally you could try some codec designed for screen capture like TechSmith or iSCC or something elseelse.

You could try to detect changes on the screen and save only modified frames but this is already done by codecs.

Some codec has some limitation about frame size (odd,even, 4x,..) and/or frame format (RGB,YV2/12,...)

The codec need to be installed in your computer and in the computer where the resulting video will played. Finally your need to link the opencv_ffmpeg library and deploy the related opencv_ffmpeg DLL

Short answer: better codec is the way.

You could use codec like DivX/mpeg

// High compression rate lossy image quality
int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

or lossless codec like Lagarith or FFV1

// Lossless in quality with good processing performance
int codec = cv::VideoWriter::fourcc('L', 'A', 'G', 'S');

Finally you could try some codec designed for screen capture capture like TechSmith or iSCC or something else.

You could try to detect changes on the screen and save only modified frames but this is already done by codecs.

Some codec codecs has some limitation limitations about frame size (odd,even, 4x,..) and/or frame format (RGB,YV2/12,...)

The codec need to be installed in your computer and in the computer where the resulting video will played. Finally your you need to link the opencv_ffmpeg library and deploy the related opencv_ffmpeg DLL

Short answer: better codec is the way.

You could use codec like DivX/mpeg

// High compression rate lossy image quality
int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

or lossless codec like Lagarith or FFV1

// Lossless in quality with good processing performance
int codec = cv::VideoWriter::fourcc('L', 'A', 'G', 'S');

Finally you could try some codec designed for screen capture like TechSmith or iSCC or something else.

You could try to detect changes on the screen and save only modified frames but this is already done by codecs.

Some codecs has some limitations about frame size (odd,even, 4x,..) and/or frame format (RGB,YV2/12,...)

The codec need to be installed in your computer and in the computer where the resulting video will played. Finally you need to link the opencv_ffmpeg library and deploy the related opencv_ffmpeg DLL

EDIT ANSWER

Look at doc and sample...you have to use the selected codec at opening time:

_writer.open(fullFileName.toStdString(), cv::VideoWriter::fourcc('D', 'I', 'V', 'X'), FPS-5, videoSize, true);

Or, if you pass CV_FOURCC_PROMPT for the codec argument "...than a window will pop up at runtime that contains all the codec installed on your system and ask you to select the one to use..."

_writer.open(fullFileName.toStdString(), CV_FOURCC_PROMPT, FPS-5, videoSize, true);