Open lapat opened 9 years ago
@lapat can you post your export code? I was getting this error a while back and it was something to do with the way the export session was getting getting configured.
Another thing you can try is using the AVAssetExportSession
and see if you get the same error.
@mjgaylord I started to use my own AVAssetExportSession as soon as I started getting the error but still get the same error occasionally. The error will come usually after calling the export session several times (15+). Then, once I get the error once, it never goes away and I have to kill the app and restart it. I thought maybe it was related to old videos taking up space but I delete all the old videos and still get the error.
AVAsset *asset = recorder.session.assetRepresentingSegments;
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetMediumQuality];
exportSession.outputFileType=AVFileTypeQuickTimeMovie;
NSError *error;
[FCFileManager removeItemAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"tempOutput.mov"] error:&error];
if (error){
NSLog(@"File delete error %@", error);
}
exportSession.outputURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"tempOutput.mov"]];
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch ([exportSession status]) {
case AVAssetExportSessionStatusFailed
handleFailure...
}
case AVAssetExportSessionStatusCompleted:
{
handleSuccess...
}
}];
Here's my initialization calls:
recorder = [SCRecorder recorder];
recorder.session = [SCRecordSession recordSession];
recorder.captureSessionPreset = AVCaptureSessionPresetHigh;
recorder.device = AVCaptureDevicePositionBack;
recorder.maxRecordDuration = CMTimeMake(30, 1);
recorder.delegate = self;
recorder.initializeSessionLazily = NO;
videoConfiguration = recorder.videoConfiguration;
videoConfiguration.scalingMode = AVVideoScalingModeResizeAspectFill;
videoConfiguration.sizeAsSquare = YES;
[recorder startRunning];
I receive this error occasionally (when recording a video in my app 1 out of 20 times) when using mergeSegmentsUsingPreset: Error Domain=AVFoundationErrorDomain Code=-11820 "Cannot Complete Export" UserInfo=0x1748662c0 {NSLocalizedDescription=Cannot Complete Export, NSLocalizedRecoverySuggestion=Try exporting again.} { NSLocalizedDescription = "Cannot Complete Export"; NSLocalizedRecoverySuggestion = "Try exporting again."; }
When it happens, it breaks all AVPlayers in the app. None of them work and the only way to make the AVPlayers work again is to send the app to the background and bring it back to the foreground.
Any ideas of what could be happening?