Ask Your Question

rafiwitten's profile - activity

2017-08-29 07:32:46 -0600 received badge  Notable Question (source)
2016-05-24 07:55:10 -0600 received badge  Popular Question (source)
2012-10-23 15:38:39 -0600 asked a question Saving video losslessly (RGB)

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!