I\'m currently trying to put 5 videos back to back using AVMutableComposition like so:
[mixComposition insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset1.du
I just met the same problem. Turn out the solution is using AVMutableCompositionTrack and compositing the video tracks, something like this.
AVMutableCompositionTrack * videoTrack = [composition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackID_Invalid];
[videoTrack insertTimeRange:CMTimeRangeMake(kCMTimeZero, asset.duration) ofTrack:[[asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:composition.duration error:&error];
For the audio part I think you must add a separate track with AVMediaTypeAudio type.
I had the same problem the other day.
If you got your assets(asset1, asset2, etc.) by exporting them from other asset which was created using again insertTimeRange, then it's the same case.
The problem is that when you export assets created using insertTimeRange, the export doesn't go correct, when you attach such videos black frames appear between them.
Try using "timeRange" option of the AVAssetExportSession, and cut the range you need from the main asset. Then your assets will attach correct.