ios - iPhone相机无法设置长时间曝光

标签 ios iphone avfoundation avcapturesession avcapturedevice

我在设置自定义曝光持续时间时遇到问题。 根据Apple documentation设置曝光持续时间的唯一方法是使用方法 setExposureModeCustomWithDuration:ISO:completionHandler:。但是,当我设置任何高于 0.07 的值并且拍摄图像时,曝光时间的值为 0.06666666666666667,尽管 AVCaptureDevice 的 maxExposureDuration 属性返回最大值可以是 0.5 秒。

曝光持续时间是否会与其他相机属性发生冲突? 还是我做错了什么?

代码:

@try
{
    NSError* error;
    [self.captureDevice lockForConfiguration:&error];

    if (!error)
    {
        // Setup of other properties

        if ([self.captureDevice isExposureModeSupported:selectedExposureMode])
        {
            if (selectedExposureMode == AVCaptureExposureModeCustom) {
                [self.captureDevice setExposureModeCustomWithDuration:exposureTimeValue ISO:isoValue completionHandler:^(CMTime syncTime) {}];
            }
        }
    }
}
@catch (NSException *exception)
{
    NSLog(@"%@",exception);
}
@finally
{
    [self.captureDevice unlockForConfiguration];
}

最佳答案

我测试了曝光持续时间 = 0.5,这是有效的,我在更改持续时间之前执行了setExposureMode

[self.captureDevice setExposureMode:AVCaptureExposureModeCustom];
[self.captureDevicesetExposureModeCustomWithDuration:CMTimeMake( 1, 2 ) ISO:iso completionHandler:^(CMTime syncTime) {}];

关于ios - iPhone相机无法设置长时间曝光,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35717821/

相关文章:

ios - 如何在运行 React Native 应用程序的 iOS 设备中启用实时重新加载?

ios - 我能否以编程方式在 `for` 循环中设置条件?

iphone - 在 iPhone 中截取 View 时内存不足警告

iphone - 重新加载 AVMutableComposition

ios - 明确反对 UIViewAnimationOptionOverrideInheritedDuration?

iOS Swift 3 performSelector onMainThread

iphone - 我的 xib nib 文件无法加载 ipad 版本,为什么?

php - 如果无法使用端口 2195,如何使用 Apple Push Notifications?

ios - 在 iPhone X 上的 ARKit ARSession 期间从前置摄像头录制视频

iOS 离线 HLS 文件大小