All the examples of using AVVideoCompositionCoreAnimationTool with AVAssetExportSession that I've found set the properties of the session to match a preexisting video track passed as the asset in the session's init method. I need to export a cool CALayer with animations without a pre-existing video track. I know I need to use `AVVideoCompositionCoreAnimationTool(additionalLayer: ..., asTrackID: ...)` though I don't know what I'm suppossed to do with the track ID, or where I'm suppossed to get it. I figured out I need to initialize the session with an AVMutableComposition (which took hours to figure out), and I sort of expect I need to add a video track to that, but again I don't know what to do with the track id. So I'm still stuck when I begin exporting, with the two errors:
session error = Error Domain=AVFoundationErrorDomain Code=-11822 "Cannot Open" UserInfo={NSLocalizedFailureReason=This media format is not supported., NSLocalizedDescription=Cannot Open, NSUnderlyingError=0x604000259c20 {Error Domain=NSOSStatusErrorDomain Code=-16976 "(null)"}}
The output file is never created.
I tried fiddling with the presets of the session, I haven't found one which produces different errors yet.
Is there a recipe of how to use these two classes together somewhere, without a preexisting video background track?
I'd like for my users to be able to set the frame size & frame rate (perhaps from a popup list of predetermined options, if necessary).
I'm starting with macos.