Hello,
I'm experimenting with writing videos in iOS 7.1, by simply copying one video file into another. Here's the code:
cv::VideoCapture iVideo(iFile);
if ( !iVideo.isOpened() ){
NSLog(@"Cannot open video capture file");
return;
};
// -- a bunch of iVideo.get() calls to determine CV_CAP_PROP_***.
// They all return "1". Why??
cv::Size size(720, 480); // Manually set, since we can't get() it.
int fourcc = CV_FOURCC('m', 'p', '4', 'v'); // Manually set since we can't get() it.
cv::VideoWriter videoWriter;
videoWriter.open(oFile, fourcc, 30, size, true);
if (!videoWriter.isOpened() ){
NSLog(@"Cannot open video writing file");
return;
}
cv::Mat frame;
iVideo >> frame;
int frameCount = 0;
while ( !frame.empty() && frameCount < 50){
frameCount++;
videoWriter << frame; // <----- throws EXC_BAD_ACCESS here.
iVideo >> frame;
}
The oddest thing is the code works when I'm targeting OS X. All CV_CAP_PROP_* are returned properly. But the same code doesn't work when targeting iOS.
Also, I've tried saving the frames using imwrite(). That works too.
I hope someone can help. Thanks!