IOS Capture 12 MP视频(IPhone 6s)的产量为1000x750
据 iPhone 6s和6s Plus都可以拍摄1200万像素的照片(4032x3024) 通过AVCaptureStillImageOutput和can 通过以下方式向您的流程提供高达30 fps 12 MP的帧 AVCaptureVideoDataOutput。当您将AVCaptureSessionPresetPhoto用作 您的AVCaptureSession的-会话预设,1200万像素的“420f”格式 默认情况下选择 因此,我尝试使用以下代码:IOS Capture 12 MP视频(IPhone 6s)的产量为1000x750,ios,iphone,avcapturesession,avcapture,avcaptureoutput,Ios,Iphone,Avcapturesession,Avcapture,Avcaptureoutput,据 iPhone 6s和6s Plus都可以拍摄1200万像素的照片(4032x3024) 通过AVCaptureStillImageOutput和can 通过以下方式向您的流程提供高达30 fps 12 MP的帧 AVCaptureVideoDataOutput。当您将AVCaptureSessionPresetPhoto用作 您的AVCaptureSession的-会话预设,1200万像素的“420f”格式 默认情况下选择 因此,我尝试使用以下代码: self.captureSession.
self.captureSession.sessionPreset = AVCaptureSessionPresetPhoto;
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];
videoOutput.alwaysDiscardsLateVideoFrames = YES;
[videoOutput setSampleBufferDelegate:self queue:dispatch];
[self.captureSession addOutput:videoOutput];
我的设备的活动格式设置为:
设备格式:AVCaptureDeviceFormat:0x12c684630‘vide’/‘420f’
4032x3024,{3-30fps},视场:57.716,最大变焦:189.00(上标度为1.00),
自动对焦系统:2,ISO:23.0-1840.0,SS:0.000013-0.333
看起来不错
但是,我在captureOutput
回调中添加了以下代码:
CVPixelBufferLockBaseAddress(imageBufferRef,0);
size_t width = CVPixelBufferGetWidth(imageBufferRef);
size_t height = CVPixelBufferGetHeight(imageBufferRef);
CVPixelBufferUnlockBaseAddress(imageBufferRef,0);
NSLog(@"ImageCameraSource:\n width:%zu\n height:%zu\n", width, height);
它输出
ImageCameraSource:
宽度:1000
身高:750
为什么回调4032x3024中没有分辨率?尝试使用
AVCaptureSessionPreset3840x2160
实时获取最高分辨率的帧
self.captureSession.sessionPreset = AVCaptureSessionPreset3840x2160;
AVCaptureVideoDataOutput* videoOutput = [[AVCaptureVideoDataOutput alloc] init];
videoOutput.alwaysDiscardsLateVideoFrames = YES;
[videoOutput setSampleBufferDelegate:self queue:dispatch];
[self.captureSession addOutput:videoOutput];
使用视频时,照片预设不起作用。根据: 要以1080p60格式的更高帧速率捕获视频,或以4K格式的更高分辨率捕获视频,必须通过为AVCaptureDevice activeFormat属性选择适当的AVCaptureDeviceFormat选项来配置捕获
您必须循环使用捕获设备的所有
格式,将activeFormat
设置为所需格式(类似于AVCaptureDevice
文档中的帧速率选择循环代码)。我还发现,您必须将预设设置为AVCaptureSessionPresetInputPriority
,才能实现12MP输出。我感觉到您的痛苦……我一直在研究这个问题。您正在尝试从captureOutput(captureOutput:AVCaptureOutput!、didOutputSampleBuffer:CMSampleBuffer!、fromConnection connection:AVCaptureConnection!)
或从captureOutput获取4032x3024帧吗。为什么?这是错误的吗?我在我的应用程序中发现,当使用AVCaptureSessionPresetPhoto时,didOutputSampleBuffer
缓冲区是1000x750,但从captureStillImageAsynchronouslyFromConnection
输出3264x2448返回的缓冲区。我通过查看会话默认AVCaptureDeviceFormat上的高分辨率图像维度发现了这一点:如果让我猜一猜,我会说API在照片预设中返回1000x750缓冲区30/秒用于视频预览,并期望人们在需要时通过captureStillImageAsynchronouslyFromConnection