开发者

AVVideocomposition AVPlayerItem position of video-layer

开发者 https://www.devze.com 2023-03-15 20:30 出处:网络
I used Apple\'s AVEdit-Dem开发者_如何转开发o, tweaked it a little and was able to add CALayers with animations and images to the video-composition. So far, this works fine.

I used Apple's AVEdit-Dem开发者_如何转开发o, tweaked it a little and was able to add CALayers with animations and images to the video-composition. So far, this works fine.

It uses AVVideoComposition and AVPlayer/AVPlayerItem to merge videos (and show them - the export rendering is a little different).

I added a layer with a png with some transparent areas, sort of like a mask, that hides parts of the video. Now I need to move the video-layer, so I can adjust the hidden parts (a.k.a. the visible part). The Mask covers the whole screen (in a CALayer), so moving the Mask-Layer isn't an option.

I didn't find any properties or methods, to adjust the position of the video-layer...

Any Ideas?


Found it...

I had to access the AVMutableCompositionTrack in the AVMutableVideoComposition and set the preferredTransform there (CGAffineTransformTranslate).

However - the Docs state, that this should be possible in a AVMutableComposition as well (AVAssetTrack setPreferredTransform). I couldn't get this to work, though.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号