Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AVCaptureVideoDataOutput and setting kCVPixelBufferWidthKey & kCVPixelBufferHeightKey

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 ?

like image 316
Or Arbel Avatar asked Nov 01 '11 14:11

Or Arbel


1 Answers

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

this sums it up.

like image 161
Or Arbel Avatar answered Sep 28 '22 09:09

Or Arbel