一直对此比较疑惑,而且代码里似乎也找不到相关所以网上找了下,大概就下面这几种把
if(videoWriter==NULL) filename = filenamePrefix + ".avi";
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('D','I','V','X'),fps,cvGetSize(f));if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('M','J','P','G'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('P','I','M','1'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('P','I','C','1'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('M','P','4','2'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('D','I','V','3'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('V','P','3','1'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('V','P','3','0'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('C','V','I','D'),fps,cvGetSize(f));
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC('f','f','d','s'),fps,cvGetSize(f));
if(videoWriter==NULL) filename = filenamePrefix + ".mpg";
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),CV_FOURCC_DEFAULT, fps,cvGetSize(f));
if(videoWriter==NULL) filename = filenamePrefix + ".avi";
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),-1, fps,cvGetSize(f)); // ask usr to choose
if(videoWriter==NULL) filename = filenamePrefix + "_00001.png";
if(videoWriter==NULL) videoWriter = cvCreateVideoWriter(filename.c_str(),0, fps,cvGetSize(f)); // fall back on image output
if(videoWriter==NULL) // unable to write anything...
from http://comments.gmane.org/gmane.comp.lib.opencv/43761