我使用以下方法将视频保存到文件中:
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"test9.avi"];
NSLog(@"Open to: %@", documentsDirectory);
std::string fileName([documentsDirectory cString], [documentsDirectory cStringLength]);
videoWriter = new cv::VideoWriter(fileName, CV_FOURCC('H', 'F', 'Y', 'U'), 25, cvSize(288,352),1);
但我无法用 VideoCapture 打开它:
NSLog(@"Load the video");
videoCapture = new cv::VideoCapture();
NSLog(@"Video loaded");
if (videoCapture->open(fileName))
{
NSLog(@"Opened");
}
else {
NSLog(@"Failed to open");
}
VideoCapture 本身没有错误,只是我的日志“无法打开”......我能以某种方式获得更详细的错误日志吗?