AVCaptureVideoDataOutput并设置kCVPixelBufferWidthKey& kCVPixelBufferHeightKey [英] AVCaptureVideoDataOutput and setting kCVPixelBufferWidthKey & kCVPixelBufferHeightKey

查看:72
本文介绍了AVCaptureVideoDataOutput并设置kCVPixelBufferWidthKey& kCVPixelBufferHeightKey的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过设置kCVPixelBufferWidthKey和[amp; kCVPixelBufferHeightKey.
问题是缓冲区的宽度和高度从不改变,它们总是返回 852x640

I'm trying to capture frames in a specific size from AVCaptureVideoDataOutput by setting kCVPixelBufferWidthKey & kCVPixelBufferHeightKey.
Problem is the buffer width and height never change, they always come back 852x640

这是我的代码:

// Add the video frame output   
    self.videoOutput = [[AVCaptureVideoDataOutput alloc] init];
    [videoOutput setAlwaysDiscardsLateVideoFrames:YES];
// Use RGB frames instead of YUV to ease color processing
[videoOutput setVideoSettings:[NSDictionary dictionaryWithObjectsAndKeys:
                               [NSNumber numberWithFloat:320.0], (id)kCVPixelBufferWidthKey,
                               [NSNumber numberWithFloat:320.0], (id)kCVPixelBufferHeightKey,
                               [NSNumber numberWithInt:kCVPixelFormatType_32BGRA],(id)kCVPixelBufferPixelFormatTypeKey,
                                                              nil]];
 [videoOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];   

来自iOS AVCaptureOutput.h:当前,唯一受支持的密钥是kCVPixelBufferPixelFormatTypeKey.

from iOS AVCaptureOutput.h: Currently, the only supported key is kCVPixelBufferPixelFormatTypeKey.

有人知道设置输出缓冲区宽度/高度的工作方法吗?

anyone knows a working method of setting the output buffer width/height ?

推荐答案

from iOS AVCaptureOutput.h:Currently, the only supported key is kCVPixelBufferPixelFormatTypeKey.

from iOS AVCaptureOutput.h: Currently, the only supported key is kCVPixelBufferPixelFormatTypeKey.

总结一下.

这篇关于AVCaptureVideoDataOutput并设置kCVPixelBufferWidthKey& kCVPixelBufferHeightKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆