我如何使用AVAssetWriter? [英] How do I use AVAssetWriter?

查看:92
本文介绍了我如何使用AVAssetWriter?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想拍摄一些视频帧并将其编码为视频。看起来这正是 AVAssetWriter 的意思,但无论我如何看待文档和谷歌我都找不到任何实际使用它的方法。从文档看起来我需要一个输入( 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?

推荐答案

啊是的,我必须使用 + [获取一个实例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.

这篇关于我如何使用AVAssetWriter?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆