I create a composition with several video clips, i also add some empty ranges where I show title screens with CoreAnimation.
|--Video1--|--NoVideo(AVsyncLayer)--|--Video2--|
Etc… Which all works fine, the problem comes when I start using:
AVMutableVideoComposition, AVMutableVideoCompositionInstruction and AVMutableVideoCompositionLayerInstruction which I have to do to rotate videos properly.
|--Video1--|--NoVideo(AVsyncLayer)--|
Works fine in my AVPlayer, but if I instead do:
|--NoVideo(AVsyncLayer)--|--Video1--|
The application crashes the next time I push a new view controller, or pop the current view controller in my Navigation Controller stack. Sometimes with a memory warning sometimes without it, but according to instruments I only allocated 1.5Mb.
I’ve watched the Working With Media in AVFoundation from last years WWDC several times, and the only thing I can think of is that the comment
AVMutableVideoCompositionInstruction must not overlap or contain gaps.
Which it really doesn’t. I have instructions for the full duration of the composition. But there are gaps in the AVMutableCompositionTrack (my video track) where I don’t plan to show video, but only the CoreAnimation layer.
Have anyone else experienced similar issues?
insert empty time range works in some cases, but we found it wasn’t good enough as it broke when we let the user rewind/fast-forward and change on the time bar. To solve this we added a black video clip when nothing else was showing.