Saving video losslessly (RGB)

asked 2012-10-23 15:38:39 -0600

rafiwitten gravatar image

updated 2012-10-24 01:58:34 -0600

Kirill Kornyakov gravatar image

I'm really struggling to save RGB video losslessly using OpenCV in C++.

I'm attempting to use the VideoWriter class like so: VideoWriter vw(outputFile, CV_FOURCC(...), 30, currFrame.size(), true)

and experimenting with different options to pass into CV_FOURCC.

Reading

http://opencv.willowgarage.com/wiki/VideoCodecs

suggests CV_FOURCC("D", "I", "B", " ") is a good option for me. Alas then vw.isOpened() fails (not sure how to debug that...). Therefore I explored other options but none seem to meet my needs.

Both CV_FOURCC('H', 'F', 'Y', 'U') and CV_FOURCC('I', 'Y', 'U', 'V') "work" but neither is lossless (and IYUV in particular seems to have weird artifacts in the top left corner). The rest of the options on my system seem to be lossy.

Does anyone have any ideas - either on how to get uncompressed RGB working or on alternatives? I'd really like to avoid writing out a ton of .png files...

I'm on Ubuntu 12.04 and using OpenCV 2.4.2 - please let me know what other information I can give you guys!

edit retag flag offensive close merge delete

Comments

Does your question differ from this one: http://answers.opencv.org/question/774/?

Kirill Kornyakov gravatar imageKirill Kornyakov ( 2012-10-24 01:58:01 -0600 )edit