[英]Capturing video on iOS: what is the difference between capturing video using AVMovieFileOutput or AVAssetWriter?
I am following this tutorial on how to capture video on iOS. 我正在关注如何在iOS上捕获视频的本教程。
When you download their sample code and run it, it shows two methods of capturing video, using AVMovieFileOutput
and using AVAssetWriter
. 当您下载示例代码并运行它时,它会显示两种捕获视频的方法,使用
AVMovieFileOutput
并使用AVAssetWriter
。
What is the technical difference between the two methods? 这两种方法有什么技术差异? is one better than the other?
这个比那个好吗?
Both AVMovieFileOutput
and AVAssetWriter
(in conjunction with AVCaptureVideoDataOutput
) allow you to capture media samples to files, but AVAssetWriter
is the lower level and more configurable * of the two interfaces, so with AVAssetWriter
/ AVCaptureVideoDataOutput
you can intercept and modify media samples before they are written which allows you to apply effects, and stream off the device, etc. AVMovieFileOutput
和AVAssetWriter
(与AVCaptureVideoDataOutput
结合使用)允许您将媒体样本捕获到文件,但AVAssetWriter
是两个接口的较低级别和更多可配置* ,因此使用AVAssetWriter
/ AVCaptureVideoDataOutput
您可以在写入之前拦截和修改媒体样本它允许您应用效果,然后流出设备等。
Last time I checked you couldn't add both AVMovieFileOutput
and AVCaptureVideoDataOutput
to an iOS capture session, so as soon as you want to examine and record the data flowing through the session in real time, you have no choice but to use AVAssetWriter
/ AVCaptureVideoDataOutput
. 上次我检查过你无法将
AVMovieFileOutput
和AVCaptureVideoDataOutput
都添加到iOS捕获会话中,因此只要您想要实时检查和记录流经会话的数据,您就别无选择,只能使用AVAssetWriter
/ AVCaptureVideoDataOutput
。
* in fact AVMovieFileOutput
is probably implemented using AVAssetWriter
. *实际上
AVMovieFileOutput
可能是使用 AVAssetWriter
实现的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.