I'm going to analyze the video while it is recording. I have analyzing function to analyze the video. But it needs the binary data 开发者_如何学Pythonof video. What can i use?
You need to set the sample buffer delegate on the AVCaptureVideoDataOutput
object of your AVCaptureSession
. Make sure what ever you set as the sample buffer delegate adopts the following protocol, AVCaptureVideoDataOutputSampleBufferDelegate
. Below is an example of how you would set the sample buffer delegate assuming the object you called it from adopts the protocol I mentioned.
[captureOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
Then the you need to implement the following method
- (void)captureOutput:(AVCaptureOutput *)captureOutput
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
fromConnection:(AVCaptureConnection *)connection
This will be called by your AVCaptureVideoDataOutput
object and the binary data of the video will be in sampleBuffer
.
Note sampleBuffer
will only contain a slice of the data.
精彩评论