了解AVCaptureDeviceFormat是否适合视频录制 [英] Understand if an AVCaptureDeviceFormat suits video recording

查看:143
本文介绍了了解AVCaptureDeviceFormat是否适合视频录制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我正在开发的应用中,我想让用户选择视频录制的分辨率.根据规范,我不能使用AVCaptureSessionPreset常量.
获取格式列表时,分辨率超过3000像素当然不能用于视频抓取,而只能用于照片拍摄.

In an app that I'm developing I'd like to let the user choose the the resolution of video recording. Due to specification, I can't use AVCaptureSessionPreset constants.
Getting format list there are resolutions above 3000px that of course can't work for video grabbing but only for photo shooting.

AVCaptureDeviceFormat:0x17020c830'vide'/'420f'3264x2448,{2- 30 fps},HRSI:3264x2448,fov:58.040,最大变焦:153.00(@ 1.00放大),AF 系统:2,ISO:29.0-1856.0,SS:0.000013-0.500000

AVCaptureDeviceFormat: 0x17020c830 'vide'/'420f' 3264x2448, { 2- 30 fps}, HRSI:3264x2448, fov:58.040, max zoom:153.00 (upscales @1.00), AF System:2, ISO:29.0-1856.0, SS:0.000013-0.500000

我找不到一种方法来查看特定格式是否适合视频录制.
问题是,如果使用这种分辨率,如果我尝试捕获视频,则该应用会生成一个异常,说明没有活动或已启用的连接.

I can't find a way to see if a specific format is suitable for video recording.
The problem is that with this kind of resolution if I try to grab a video the app generates an exception saying that there is no active or enabled connection.

-[AVCaptureMovieFileOutput startRecordingToOutputFileURL:recordingDelegate:]-没有激活/启用 连接.

-[AVCaptureMovieFileOutput startRecordingToOutputFileURL:recordingDelegate:] - no active/enabled connections.

我也不想硬编码每种设备的限制.
我也不能尝试将上限限制为AVCaptureSessionPresetHigh,因为如

I also don't want to hardcode limits for each kind of device.
I can't also try to cap the limit to AVCaptureSessionPresetHigh because as stated in an Apple note is not the actual maximum format.
Is there a way to understand if a AVCaptureDeviceFormat is suitable for grabbing video?

推荐答案

使用选定的-activeFormat设置所有连接后,检查当前AVCaptureConnection isActive还是使用KVO观察属性-active.如果不是,则该格式不可用于视频抓取;如果是,则可以使用该格式.

After setting all the connections with the selected -activeFormat check if the current AVCaptureConnection isActive or observe using KVO the property -active. If it is no the format is not available for video grabbing, if it is yes it can be used.

这篇关于了解AVCaptureDeviceFormat是否适合视频录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆