ios - CMTimeMakeWithSeconds 中的首选时间刻度

标签 ios swift avfoundation cmtime

我正在实现自定义相机,为此我想设置曝光持续时间。

我设置 slider 属性的代码是-

slider.maximumValue = Float(CMTimeGetSeconds(camera.activeFormat.maxExposureDuration))
slider.minimumValue = Float(CMTimeGetSeconds(camera.activeFormat.minExposureDuration))

现在每当更改 slider 时设置曝光时间就会出现问题。

我的代码看起来像这样 -

change(duration: CMTimeMakeWithSeconds(Double(slider.value), 600), iso: AVCaptureISOCurrent)

但是在

func CMTimeMakeWithSeconds(_ seconds: Float64, _ preferredTimescale: Int32) -> CMTime

我对 preferredTimescale 感到困惑,它的值应该是多少,它在 600 下工作正常,但理想值是多少。

最佳答案

您应该查看讨论 here

Preferred time scale 将为你的秒数添加一个分母,这意味着如果你设置 5 秒并且 preferredTimeScale 为 60,它将是 1/12 秒

关于ios - CMTimeMakeWithSeconds 中的首选时间刻度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45348231/

相关文章:

ios - 带有切出段和阴影的 UIView

ios - RTSP 和 iOS : How to tackle this?

ios - 从 AudioQueueBufferRef 输出队列回调中获取音频 float

cocoa - 如何使用 AVFoundation 从视频中获取 openGL 纹理?

ios - 同时更改所有表格 View 单元格上的显示参数

ios - 自定义 MKOverlayRenderer drawMapRect 函数不绘制多边形

ios - 自定义导航栏后退按钮标题

ios - 在 shouldChangeCharactersIn 中将文本设置为 UITextField 后,光标移至末尾

ios - Firestorage 关闭时显示图像的正确方法或在 Firestorage for iOS 中加载预览时出错

swift - 如何从 Swift 协议(protocol)返回 `[Self]`?