AVAssetWriter中AVAssetWriterInputPixelBufferAdaptor的重要性

问题描述 投票:1回答:1

我正在尝试使用AVAssetWriter输出从相机捕获的视频。

我正在关注一些不使用AVAssetWriterInputPixelBufferAdaptorRecord video with AVAssetWriter)的例子,以及一些不使用AVCaptureSession only got video bufferAVAssetWriterInputPixelBufferAdaptor)的例子。

基于Apple的参考资料,我已经将CVPixelBuffer, CVPixelBufferPool(或AVAssetWriter)的目的解释为一种缓冲内存中传入像素的有效方法。在实践中,使用AVAssetWriterInputPixelBufferAdaptor编写视频输出时使用它有多重要?我似乎能够在不使用适配器的情况下获得基本版本,但我想更多地了解使用- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection *)connection{ if (videoWriterInput.readyForMoreMediaData) { [videoWriterInput appendSampleBuffer:sampleBuffer]; } } 的好处/意图。

ios video avassetwriter
1个回答
0
投票

我已经使用没有PixelBufferAdaptor的视频录制多年没有任何问题。我基本上使用这个代码:

qazxswpoi

我的看法是,由于CMSampleBufferRef包含时序信息,因此可以直接写入。如果您有CVPixelBuffer,则必须通过适配器添加时序信息。因此,如果您在编写之前进行一些图像处理,最终将使用CVPixelBuffer并且必须使用适配器。如果您的处理需要时间,适配器还可能为CVPixelBuffer添加一些缓冲功能。

© www.soinside.com 2019 - 2024. All rights reserved.