Reducing AVCaptureVideoDataOutput framerate
Reducing AVCaptureVideoDataOutput framerate
- Subject: Reducing AVCaptureVideoDataOutput framerate
- From: Luke Scott <email@hidden>
- Date: Tue, 17 May 2011 13:42:43 -0700
- Thread-topic: Reducing AVCaptureVideoDataOutput framerate
I'm developing a barcode scanner application, specifically for the
iPhone/iPod Touch. I'm using the ZXing open source library in conjunction
with AVCaptureVideoDataOutput and sampleBufferDelegate to decode QRCodes
from the video camera.
I'm trying to reduce the frame rate to the sampleBufferDelegate so the ZXing
library doesn't decode 30 frame per second. Something like 10 fps might be
more practical.
But when I do this (which should reduce it down to 1 fps):
captureOutput.minFrameDuration = CMTimeMake(1, 1);
Nothing seems to be different. The AVCaptureVideoPreviewLayer isn't affected
at all, and the sampleBufferDelegate seems to be processing just as many
frames as before.
This is my init function:
- (id)init
{
self = [super init];
if(self)
{
AVCaptureDevice *captureDevice = [AVCaptureDevice
defaultDeviceWithMediaType:AVMediaTypeVideo];
captureInput = [[AVCaptureDeviceInput alloc]
initWithDevice:captureDevice error:nil];
captureOutput = [[AVCaptureVideoDataOutput alloc] init];
captureSession = [[AVCaptureSession alloc] init];
[captureOutput setVideoSettings:[NSDictionary
dictionaryWithObject:[NSNumber numberWithInt:kCVPixelFormatType_32BGRA]
forKey:(id)kCVPixelBufferPixelFormatTypeKey]];
[captureOutput setAlwaysDiscardsLateVideoFrames:YES];
[captureOutput setSampleBufferDelegate:self
queue:dispatch_get_main_queue()];
[captureSession setSessionPreset:AVCaptureSessionPresetMedium];
[captureSession addInput:captureInput];
[captureSession addOutput:captureOutput];
// Isn't doing anything?
captureOutput.minFrameDuration = CMTimeMake(1, 1);
scanner = nil;
delegage = nil;
preview_ = nil;
previewLayer = [[AVCaptureVideoPreviewLayer alloc]
initWithSession:captureSession];
}
return self;
}
Does anyone know why this isn't working?
Luke
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden