Hi!
I'm using a pre-compiled version of OpenCV I got from here: http://aptogo.co.uk/2011/09/opencv-framework-for-ios/
I'm working on a Ogre3D Application, and I'm trying to grab screens from the app to stitch together to make a video. I've successfully gotten this to work on Windows using OpenCV's CvVideoWriter.
Unfortunately, I'm running into some problems on the iOS version of this. My code is as follows" IplImage *mCvCaptureImage, *mCvConvertImage; mCvCaptureImage = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3); mCvConvertImage = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 3); PixelFormat pf = win->suggestPixelFormat(); PixelBox pb(width, height, 1, pf, mCvCaptureImage->imageData); win->copyContentsToMemory(pb); // swap red and blue channels cvConvertImage(mCvCaptureImage, mCvConvertImage, CV_CVTIMG_SWAP_RB); cvWriteFrame(writer, mCvConvertImage ); cvReleaseImage(&mCvConvertImage); cvReleaseImage(&mCvCaptureImage); }
The cvWriteFrame call is throwing an error due to writer status check. I checked the source code, and this seems to be the problem:
// writer status check if (![mMovieWriterInput isReadyForMoreMediaData] || mMovieWriter.status != AVAssetWriterStatusWriting ) { NSLog(@"[mMovieWriterInput isReadyForMoreMediaData] Not ready for media data or ..."); NSLog(@"mMovieWriter.status: %d. Error: %@", mMovieWriter.status, [mMovieWriter.error localizedDescription]); [localpool drain]; return false; }
Anyone has any ideas why this is happening and how it can be fixed?
Thanks!