Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS 5: Error merging 3 videos with AVAssetExportSession
    primarykey
    data
    text
    <p>I'm trying to merge (append) 3 videos using AVAssetExportSession, but I keep getting this error. Weirdly for 1 or 2 videos it worked.</p> <pre><code>Error Domain=AVFoundationErrorDomain Code=-11820 "Cannot Complete Export" UserInfo=0x458120 {NSLocalizedRecoverySuggestion=Try exporting again., NSLocalizedDescription=Cannot Complete Export} </code></pre> <p>I even tried to redo the function in case of error but what I got is only infinite error message. This is the snippet of my code.</p> <pre><code>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&lt;[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:&amp;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]; } }]; </code></pre> <p>Is there something wrong with my code or iOS 5 has some bug?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload