AVCaptureSession w/o解压
AVCaptureSession w/o Decompression
环境
- OS-X
- Yosemite
- Objective-C
- 压缩视频输入(AVCaptureDeviceFormat == 'muxx'/'isr ')
用例
压缩视频流作为支持 'muxx/isr ' 有效负载格式的 HAL 捕获设备 ( AVCaptureDevice ) 公开给 OS,我希望能够直接访问压缩的原始字节有效负载 w/o 正在解压缩。
实施
- 使用“+ (AVCaptureDevice *)deviceWithUniqueID:(NSString *)deviceUniqueID”查找设备
- 创建“AVCaptureDeviceInput”
- 创建“AVCaptureVideoDataOutput”
- 将“AVCaptureDevice”与“AVCaptureDeviceInput”相关联
- 在“AVCaptureVideoDataOutput”上设置SampleBufferDelegate
- 创建AVCaptureSession
- 通过添加输入和输出配置会话(未选择预设)
- 通过调用 [session startRunning] 启动会话
- 基于“AVCaptureVideoDataOutputSampleBufferDelegate' invocation call 'CMSampleBufferGetDataBuffer(sampleBuffer);”获取对 RAW 缓冲区的引用
问题描述
当系统调用代理时,我得到的缓冲区是指解码的 yuy2 图像而不是压缩缓冲区(在它被解复用和解码之前),因此,'CMSampleBufferGetDataBuffer' returns 一个 nil 指针。
如何获取AVCaptureDevicew/o解压发送的RAW payload?
解决方案是使用 C++ CoreMediaIO 框架,这里提供了示例 link, the main problem with CoreMediaIO is that it is not widely used and has minimal documentation, the sample code provided by Apple is old and req quite much tinkering before it can compile with recent SDKs, however, in the end, it works, this Blog entry 有一个很好的示例。
环境
- OS-X
- Yosemite
- Objective-C
- 压缩视频输入(AVCaptureDeviceFormat == 'muxx'/'isr ')
用例
压缩视频流作为支持 'muxx/isr ' 有效负载格式的 HAL 捕获设备 ( AVCaptureDevice ) 公开给 OS,我希望能够直接访问压缩的原始字节有效负载 w/o 正在解压缩。
实施
- 使用“+ (AVCaptureDevice *)deviceWithUniqueID:(NSString *)deviceUniqueID”查找设备
- 创建“AVCaptureDeviceInput”
- 创建“AVCaptureVideoDataOutput”
- 将“AVCaptureDevice”与“AVCaptureDeviceInput”相关联
- 在“AVCaptureVideoDataOutput”上设置SampleBufferDelegate
- 创建AVCaptureSession
- 通过添加输入和输出配置会话(未选择预设)
- 通过调用 [session startRunning] 启动会话
- 基于“AVCaptureVideoDataOutputSampleBufferDelegate' invocation call 'CMSampleBufferGetDataBuffer(sampleBuffer);”获取对 RAW 缓冲区的引用
问题描述
当系统调用代理时,我得到的缓冲区是指解码的 yuy2 图像而不是压缩缓冲区(在它被解复用和解码之前),因此,'CMSampleBufferGetDataBuffer' returns 一个 nil 指针。
如何获取AVCaptureDevicew/o解压发送的RAW payload?
解决方案是使用 C++ CoreMediaIO 框架,这里提供了示例 link, the main problem with CoreMediaIO is that it is not widely used and has minimal documentation, the sample code provided by Apple is old and req quite much tinkering before it can compile with recent SDKs, however, in the end, it works, this Blog entry 有一个很好的示例。