如何使用 AVAssetWriter?
我想拍摄一些视频帧并将它们编码成视频。看起来这正是 AVAssetWriter
的用途,但无论我如何查看文档和 Google,我都找不到任何实际使用它的方法。从文档看来,我需要一个输入(AVAssetWriterInput
)来为作者提供信息。美好的。但是 AVAssetWriterInput
类是抽象的,我所知道的 4.1 中唯一的子类是 AVAssetWriterInputPixelBufferAdaptor
,它在其初始化程序中需要 AVAssetWriterInput
……?我在这里遗漏了一些明显的东西吗?
I’d like to take some video frames and encode them into a video. It looks like that’s exactly what AVAssetWriter
was meant for, but no matter how I eyeball the docs and Google I can’t find any way to actually use it. From the docs it looks like I need an input (AVAssetWriterInput
) to feed the writer from. Fine. But the AVAssetWriterInput
class is abstract and the only subclass that I know of in 4.1 is AVAssetWriterInputPixelBufferAdaptor
that requires a AVAssetWriterInput
in its initializer…? Am I missing something obvious here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
啊,是的,我必须使用
+[AVAssetWriterInput assetWriterInputWithMediaType:outputSettings:]
获取一个实例,请参阅我的 在不同问题下发布以获取详细的代码示例。Ah yes, I have to acquire an instance using
+[AVAssetWriterInput assetWriterInputWithMediaType:outputSettings:]
, see my post under a different question for a detailed code sample.