大佬教程收集整理的这篇文章主要介绍了iOS 5:使用AVAssetExportSession合并3个视频时出错,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Error Domain=AVFoundationErrorDomain Code=-11820 "CAnnot Complete Export" UserInfo=0x458120 {NSLocalizedRecoverySuggestion=Try exporTing again.,NSLocalizedDescription=CAnnot Complete Export}
我甚至尝试重做函数以防出错,但我得到的只是无限错误信息.这是我的代码的片段.
AVMutableComposition *mixComposition = [AVMutableComposition composition]; AVMutableCompositionTrack *compositionTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid]; NSError * error = nil; NSMutableArray * timeRanges = [NSMutableArray arrayWithCapacity:arraymovieUrl.count]; NSMutableArray * tracks = [NSMutableArray arrayWithCapacity:arraymovieUrl.count]; for (int i=0; i<[arraymovieUrl count]; i++) { AVURLAsset *assetClip = [arraymovieUrl objectATindex:i]; AVAssetTrack *clipVideoTrackB = [[assetClip tracksWithMediaType:AVMediaTypeVideo] objectATindex:0]; [timeRanges addObject:[NSValue valueWithCMTimeRange:CMTimeRangeMake(kCMTimeZero,assetClip.duration)]]; [tracks addObject:clipVideoTrackB]; } [compositionTrack insertTimeRanges:timeRanges ofTracks:tracks atTime:kCMTimeZero error:&error]; AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPreset1280x720]; NSParameterAssert(exporter != nil); exporter.outputFileType = AVFileTypeQuickTimeMovie; exporter.outputURL = outputUrl; [exporter exportAsynchronouslyWithCompletionHandler:^{ switch ([exporter status]) { case AVAssetExportSessionStatusFailed: NSLog(@"Export Failed: %@",[exporter error]); break; case AVAssetExportSessionStatusCancelled: NSLog(@"Export canceled"); break; case AVAssetExportSessionStatusCompleted: NSLog(@"Export successfully"); break; default: break; } if (exporter.status != AVAssetExportSessionStatusCompleted){ NSLog(@"Retry export"); [self renderMovie]; } }];
以上是大佬教程为你收集整理的iOS 5:使用AVAssetExportSession合并3个视频时出错全部内容,希望文章能够帮你解决iOS 5:使用AVAssetExportSession合并3个视频时出错所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。