How do I add a still image to an AVComposition?

后端 未结 2 696
小蘑菇
小蘑菇 2021-01-31 22:16

I have an AVMutableComposition with a video track and I would like to add a still image into the video track, to be displayed for some given time. The still image i

2条回答
  •  不知归路
    2021-01-31 22:54

    OK. There’s a great video called Editing Media with AV Foundation from WWDC that explains a lot. You can’t insert images right to the AVComposition timeline, at least I did not find any way to do that. But when exporting or playing an asset you can refer to an AVVideoComposition. That’s maybe not a perfect name for the class, since it allows you to mix between various video tracks in the asset, very much like AVAudioMix does for audio. And the AVVideoComposition has an animationTool property that lets you throw Core Animation layers (CALayer) into the mix. CALayer has a contents property that can be assigned a CGImageRef. Does not help in my case, might help somebody else.

提交回复
热议问题