2011-11-01 38 views
6

我試圖通過設置kCVPixelBufferWidthKey & kCVPixelBufferHeightKey捕捉從AVCaptureVideoDataOutput特定大小的幀。
問題是緩衝區的寬度和高度永遠不會改變,他們總是回來852x640AVCaptureVideoDataOutput和設置kCVPixelBufferWidthKey&kCVPixelBufferHeightKey

這裏是我的代碼:

// 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。

有人知道設置輸出緩衝區寬度/高度的工作方法嗎?

回答

4

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

這個總結道。

+1

我希望它確實工作 - 我真的可以使用它。 :-) –

相關問題