AVMutableComposition not allowing to add 4 video track
<p>i am working with AVFoundation framework. I just want to add three videos to merge as a single video, but problem is i'm not able to add three videos. I want to know how many video we can add using AVMutableComposition. Is it allow to add more then 2 videos. Any help ?</p>

<p>here is my code </p>

<pre><code>/////////////////////////////////////////////
// Add video tracks 1 to mutable compositon//
/////////////////////////////////////////////
let firstTrack = compostion.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
do{
    try firstTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, videoAsset1.duration),
            ofTrack: videoAsset1.tracksWithMediaType(AVMediaTypeVideo)[0], atTime: kCMTimeZero)
}
catch{
    print("failed to add first track")
}
print("Time to add 1 track\(CMTimeGetSeconds(videoAsset1.duration))")

/////////////////////////////////////////////
// Add video tracks 2 to mutable compositon//
/////////////////////////////////////////////
let secondTrack = compostion.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
do{
    try secondTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, videoAsset2.duration),
            ofTrack: videoAsset2.tracksWithMediaType(AVMediaTypeVideo)[0], atTime: videoAsset1.duration)
}
catch{
    print("failed to add second track")
}
print("Time to add second track\(CMTimeGetSeconds(videoAsset2.duration))")
/////////////////////////////////////////////
// Add video tracks 3 to mutable compositon//
/////////////////////////////////////////////
let thirdTrack = compostion.addMutableTrackWithMediaType(AVMediaTypeVideo, preferredTrackID: Int32(kCMPersistentTrackID_Invalid))
do{
    try thirdTrack.insertTimeRange(CMTimeRangeMake(kCMTimeZero, videoAsset3.duration), ofTrack: videoAsset3.tracksWithMediaType(AVMediaTypeVideo)[0], atTime: videoAsset2.duration)
}
catch{
    print("failed to add third track")
}
</code></pre>