AVCaptureVideoDataOutput and setting kCVPixelBuffe

2019-06-19 18:08发布

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

Here is me code:

// 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()];   

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

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

1条回答
一夜七次
2楼-- · 2019-06-19 19:05

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

this sums it up.

查看更多
登录 后发表回答