के साथ 3 वीडियो विलय करने में त्रुटि मैं AVAssetExportSession का उपयोग करके 3 वीडियो मर्ज करने (संलग्न) करने का प्रयास कर रहा हूं, लेकिन मुझे यह त्रुटि मिल रही है। अजीब तरह से 1 या 2 वीडियो के लिए यह काम किया।आईओएस 5: AVAssetExportSession
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];
}
}];
क्या मेरे कोड या आईओएस 5 में कुछ गड़बड़ है?
आप – Edwin
के बजाय उत्परिवर्तनीय संरचना की एक प्रति का उपयोग कर निर्यातक को प्रारंभ भी कर सकते हैं उद्देश्य सी एक्सकोड 8.2.1 में AVPlayer को कैसे रिलीज़ करें? – sohil