Overlay two videos using AVMutableComposition?

Hi,


I'm trying to overlay a video on top of another video using AVMutableComposition. Eventually I'll need to crop one of the videos and center it inside the other one, but for now I'm just trying to get something working.


I tried adding both videos to my composition using the same time range, but I always just see the first video in the rendered output.


What's the trick to this -- is there some way to specify the Z-order or some other way to control what happens when two videos occupy the same time range?


Thanks,

Frank

Answered by QuinceyMorris in 275670022

Those classes have an "AVMutable…" variant that lets you set the properties.

For future reference - this tutorial contains details on how to crop and transform videos, including how to use an overlay to get the 'rounded corner' effects asked by flarosa:
https://www.raywenderlich.com/30200/avfoundation-tutorial-adding-overlays-and-animations-to-videos

Overlay two videos using AVMutableComposition?
 
 
Q