AVAssetTrack with alpha channel?

一世执手 提交于 2019-12-11 14:56:37

问题


I am trying to layer AVAssetTracks in an AVMutableComposition where the AVAssetTracks have an alpha channel in the video.

I have successfully exported an video AVAsset with pixel buffers than have an alpha channel and transparency, but when I try to add that into an AVMutableCompositionTrack and layer it, it doesnt display correctly.

Is this possible? Is the magic performed when the AVAsset is created or in a the AVMutableComposition or AVVideoComposition?

Any clues would be a huge help.


回答1:


The short answer is that you are not going to be able to get this to work with the built in AVFoundation logic since it only supports h.264 and h.264 does not support an alpha channel. But, if you use a library with alpha channel support, then it can be done. See this question for a working example. You could also implement it yourself by doing the composition operation in your own code with CoreGraphics and then exporting the flat 24BPP graphics when encoding to h.264.



来源:https://stackoverflow.com/questions/27390447/avassettrack-with-alpha-channel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!