AVCaptureMovieFileOutput记录器完成,错误代码为-16418

时间:2016-03-10 13:03:07

标签: ios iphone

didFinishRecordingToOutputFileAtURL - {
AVErrorRecordingSuccessfullyFinishedKey = 0;
NSLocalizedDescription = "Cannot Record";
NSLocalizedRecoverySuggestion = "Try recording again.";
NSUnderlyingError = "Error Domain=NSOSStatusErrorDomain Code=-16418 \"(null)\"";}

这是我在录制视频时获得的输出。

我创建AVCaptureMovieFileOutput的代码如下, - movieFileOutput = [[AVCaptureMovieFileOutput alloc] init]; // SET MAX DURATION CMTime maxDuration = CMTimeMakeWithSeconds(121, Preferred_Time_Scale); // length I can record is 120 seconds movieFileOutput.maxRecordedDuration = maxDuration; // SET MIN FREE SPACE IN BYTES FOR RECORDING TO CONTINUE ON A VOLUME movieFileOutput.minFreeDiskSpaceLimit = 1024 * 1024; // 1MB if ([captureSession canAddOutput:movieFileOutput]) [captureSession addOutput:movieFileOutput]; [captureSession setSessionPreset:AVCaptureSessionPresetMedium]; //----- START THE CAPTURE SESSION RUNNING ----- [captureSession commitConfiguration]; [captureSession startRunning];

我已尝试搜索NSOSStatusErrorDomain code=-16148的说明,但无法在任何文档中找到它(甚至来自苹果网站)

感谢任何帮助 谢谢 Satyaranjan

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,经过几个小时的调试后终于发现了什么错误。

我在开始录制后试图创建override

AVCapgureVideoPreviewLayer

显然,不应该在录制开始后从捕获会话中创建预览图层。正确的方法是在//somewhere after i called [aAVCaptureMovieFileOutput startRecording] [AVCaptureVideoPreviewLayer layerWithSession:aAVCaptureSession]; 之前配置预览图层,然后是{ {1}}。

你可以通过obj.io here找到一篇非常好的示例项目的博客文章。

答案 1 :(得分:0)

我得到了上述问题的解决方案(不确定这是否是最后一个)。

我刚评论了设置maxRecordedDuration的行,即movieFileOutput.maxRecordedDuration = maxDuration;,现在我可以记录我想要的最大值。