Я пытаюсь захватить кадры определенного размера из AVCaptureVideoDataOutput
, установив kCVPixelBufferWidthKey
и kCVPixelBufferHeightKey
.
Проблема в том, что ширина и высота буфера никогда не меняются, они всегда возвращаются 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.
Кто-нибудь знает рабочий метод установки ширины / высоты выходного буфера?