2015-04-08 28 views
0

嗨,大家好我想从我的相机中提取帧,我使用AVCaptureVideoDataOutput,这里是我的设置和我尝试设置我的pixelformatTyoe为kCVPixelFormatType_24BGR不支持的像素格式类型的Xcode

AVCaptureVideoDataOutput *videoDataOutput = [[AVCaptureVideoDataOutput alloc] init]; 
[videoDataOutput setVideoSettings:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithUnsignedInt:kCVPixelFormatType_24BGR], (id)kCVPixelBufferPixelFormatTypeKey, nil]]; 
[videoDataOutput setAlwaysDiscardsLateVideoFrames:YES]; 
[videoDataOutput setSampleBufferDelegate:self queue:sessionQueue]; 

然而,当我运行代码我收到以下错误。

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureVideoDataOutput setVideoSettings:] - 24BG (842285639) is not a supported pixel format type. See AVCaptureOutput.h for a list of supported formats. Available pixel format types on this platform are (
420v, 
420f, 
BGRA 

)'。

这是否意味着我只能使用kCVPixelFormatType_32BGRA?对我来说,我必须创建一个alpha通道,这是没有意义的。

任何意见将不胜感激。提前致谢!

+0

你认为这个问题是正确标记? – trojanfoe

+0

以及它可能不是最好的标签,我很抱歉,如果我错误地标记它..但是是啊如果你有任何意见我的问题,请给你的意见:) – lkleung1

回答

0

您可以检查availableVideoCVPixelFormatTypesAVCaptureVideoDataOutput

availableVideoCVPixelFormatTypes 
Indicates the supported video pixel formats that can be specified in videoSettings 

Please, go through apple documentation