【发布时间】:2011-10-04 10:59:57
【问题描述】:
更新 - 我为回答这个问题添加了 50 声望奖励!
我有一个应用程序,它需要将一些视频和照片放在一起,然后用它们制作电影。我为此使用 AVMutableComposition。为了能够指导它如何合成视频,我必须使用 AVMutableVideoComposition。这东西有一个名为backgroundColor 的属性,Apple 文档说:
仅支持纯 BGRA 颜色;模式和其他支持 颜色被忽略。如果渲染的像素缓冲区没有 alpha, 背景颜色的 alpha 值被忽略。
我从中了解到的是,有一种方法可以将 alpha 通道添加到 backgroundColor,但我只是不明白如何。 If the rendered pixel buffer does not have alpha, the alpha value of the background color is ignored. 是什么意思?以及如何添加这样的东西?
如果我只做myVideoCompositionInstruction.backgroundColor = [[UIColor colorWithWhite:1 alpha:0] CGColor];,它就不起作用 - 背景保持白色并且不透明。
任何帮助将不胜感激,谢谢!
【问题讨论】:
-
有人吗?我真的需要这个,但我不知道该怎么做。
-
你试过 myVideoCompositionInstruction.backgroundColor = [[UIColor clearColor] CGColor] 吗?
-
是的 - 也不这样做:(
-
[UIColor redColor].CGColor 怎么样?会变红吗?这至少会消除您没有正确使用该属性的可能性。
-
它会变成红色或我应用的任何其他颜色。无论我对它做什么,它都不会变得透明:(
标签: iphone avfoundation transparent background-color avcomposition