开发者

How to conver the video recorder file to Binary data on iPhone

开发者 https://www.devze.com 2023-04-01 11:44 出处:网络
I\'m going to analyze the video while it is recording. I have analyzing function to analyze the video.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消