AVVideoComposition to work correctly, you should init
AVCompositionTrack created by you, instead of
AVAssetTrack provided by
AVAsset. This may be unintuitive at first, because how do you apply instructions to the track you want? How do you do transitions if there is only one
AVCompositionTrack? Well, you’d create two, and alternate between them. And yes, this requires a lot of work with time ranges.
See WWDC for basic graphical of this approach: 2011 Working with Media in AV Foundation https://developer.apple.com/videos/play/wwdc2011/415/.
Also take a look at
AVCompositionDebugView to see this approach in action https://developer.apple.com/library/archive/technotes/tn2447/_index.html