4

This might be a dumb question, but I am just starting to learn about media formats and AVFoundation, so bear with me.

I've been trying to figure out whether a CMSampleBuffer from AVCaptureVideoDataOutput can have more than one frame in it. 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. 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

wciu
  • 1,183
  • 2
  • 9
  • 24
  • hi wciu, welcome. i'm not sure what you meant, can you provide some sort of sample code? – EladG Dec 10 '11 at 07:57

1 Answers1

6

It is true that a CMSampleBuffer can contain multiple samples where a sample is arbitrary data. When capturing video in AVFoundation the sample buffer will only contain a single sample. 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

Chris Markle
  • 2,076
  • 4
  • 25
  • 46
Steve McFarlin
  • 3,576
  • 1
  • 25
  • 24