简体   繁体   English

CMSampleBuffer中有多少帧?

[英]How many frames in CMSampleBuffer?

This might be a dumb question, but I am just starting to learn about media formats and AVFoundation, so bear with me. 这可能是一个愚蠢的问题,但我刚开始学习媒体格式和AVFoundation,所以请耐心等待。

I've been trying to figure out whether a CMSampleBuffer from AVCaptureVideoDataOutput can have more than one frame in it. 我一直试图弄清楚AVCaptureVideoDataOutput中的CMSampleBuffer是否可以包含多个帧。 From the documentation, it seems possible, however, most sample code I've seen seem to due with the CMSampleBuffer as if it is a single frame. 然而,从文档中可以看出,我看到的大多数示例代码似乎与CMSampleBuffer相似,就好像它是单帧一样。 Am I just misunderstanding this? 我只是误解了这个吗?

If there can be more than one frame per buffer, is it possible to get at the individual frames and determine if it is a key frame? 如果每个缓冲区可以有多个帧,是否可以获取各个帧并确定它是否是关键帧?

Thanks 谢谢

It is true that a CMSampleBuffer can contain multiple samples where a sample is arbitrary data. 确实,CMSampleBuffer可以包含多个样本,其中样本是任意数据。 When capturing video in AVFoundation the sample buffer will only contain a single sample. 在AVFoundation中捕获视频时,样本缓冲区将只包含一个样本。 While it is possible to contain more then one, this does not really make sense in practice. 虽然它可能包含多个,但这在实践中并没有多大意义。 This is especially the case if you are processing the images in realtime for video-based applications. 如果您正在为基于视频的应用程序实时处理图像,情况尤其如此。 For audio it will contain multiple samples. 对于音频,它将包含多个样本。 You can inspect it using the CM* functions listed in CMSampleBuffer.h 您可以使用CMSampleBuffer.h中列出的CM *函数进行检查

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM