Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to make a good long video (capture) with VideoWriter ?

Hello,

I want to capture my software window by using OpenCV. I found the VideoWriter class and use it to make video with screenshots taken each X msec. My software use Qt so I take a QPixmap each time, convert it to cv::Mat and add it into VideoWriter.

My problem: the video become big after only one minute and when the video is bigger than 2Go it cannot be read by video media player (Windows 7). Moreover, the video cannot be bigger than 4Go.

There is my initialize method:

cv::Size videoSize = cv::Size(_mainWindow->width(),_mainWindow->height());

int codec = cv::VideoWriter::fourcc('M', 'S', 'V', 'C'); // This codex works only with short video.

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

Can you help me to identify the problem? Is it the used codec?

Thanks in advance

click to hide/show revision 2
retagged

How to make a good long video (capture) with VideoWriter ?

Hello,

I want to capture my software window by using OpenCV. I found the VideoWriter class and use it to make video with screenshots taken each X msec. My software use Qt so I take a QPixmap each time, convert it to cv::Mat and add it into VideoWriter.

My problem: the video become big after only one minute and when the video is bigger than 2Go it cannot be read by video media player (Windows 7). Moreover, the video cannot be bigger than 4Go.

There is my initialize method:

cv::Size videoSize = cv::Size(_mainWindow->width(),_mainWindow->height());

int codec = cv::VideoWriter::fourcc('M', 'S', 'V', 'C'); // This codex works only with short video.

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

Can you help me to identify the problem? Is it the used codec?

Thanks in advance

How to make a good long video (capture) with VideoWriter ?

Hello,

I want to capture my software window by using OpenCV. I found the VideoWriter class and use it to make video with screenshots taken each X msec. My software use Qt so I take a QPixmap each time, convert it to cv::Mat and add it into VideoWriter.

My problem: the video become big after only one minute and when the video is bigger than 2Go it cannot be read by video media player (Windows 7). Moreover, the video cannot be bigger than 4Go.

There is my initialize method:

cv::Size videoSize = cv::Size(_mainWindow->width(),_mainWindow->height());

int codec = cv::VideoWriter::fourcc('M', 'S', 'V', 'C'); // This codex works only with short video.

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

Can you help me to identify the problem? Is it the used codec?

Thanks in advance


Edit

Now I use DivX correctly I think but the video look like the release fail. I cannot open it with my player. There is my code: // Select codec int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

// Create and open video file writer.open(fullFileName, codec, FPS, videoSize, true);

// Test main loop for(int j=0; j<100; j++) { takeScreenshot(writer); }

// Release video writer.release();

Have you an idea? Is it a codec problem?

Thank you for your help

How to make a good long video (capture) with VideoWriter ?

Hello,

I want to capture my software window by using OpenCV. I found the VideoWriter class and use it to make video with screenshots taken each X msec. My software use Qt so I take a QPixmap each time, convert it to cv::Mat and add it into VideoWriter.

My problem: the video become big after only one minute and when the video is bigger than 2Go it cannot be read by video media player (Windows 7). Moreover, the video cannot be bigger than 4Go.

There is my initialize method:

cv::Size videoSize = cv::Size(_mainWindow->width(),_mainWindow->height());

int codec = cv::VideoWriter::fourcc('M', 'S', 'V', 'C'); // This codex works only with short video.

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

Can you help me to identify the problem? Is it the used codec?

Thanks in advance


Edit

Now I use DivX correctly I think but the video look like the release fail. I cannot open it with my player. There is my code: // Select codec int codec = cv::VideoWriter::fourcc('D', 'I', 'V', 'X');

// Create and open video file writer.open(fullFileName, codec, FPS, videoSize, true);

// Test main loop for(int j=0; j<100; j++) { takeScreenshot(writer); }

// Release video writer.release();

Have you an idea? Is it a codec problem?

Thank you for your help