美文网首页
关于摄像头采集到视频流的帧数修改

关于摄像头采集到视频流的帧数修改

作者: iOS扫地僧 | 来源:发表于2017-09-26 10:05 被阅读0次

关键代码

- (void)updateFps:(NSInteger) fps{
    NSArray *videoDevices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
    for (AVCaptureDevice *vDevice in videoDevices) {
        float maxRate = [(AVFrameRateRange *)[vDevice.activeFormat.videoSupportedFrameRateRanges objectAtIndex:0] maxFrameRate];
        if (maxRate >= fps) {
            if ([vDevice lockForConfiguration:NULL]) {
                vDevice.activeVideoMinFrameDuration = CMTimeMake(10, (int)(fps * 10));
                vDevice.activeVideoMaxFrameDuration = vDevice.activeVideoMinFrameDuration;
                [vDevice unlockForConfiguration];
            }
        }
    }
}

相关文章

网友评论

      本文标题:关于摄像头采集到视频流的帧数修改

      本文链接:https://www.haomeiwen.com/subject/fptsextx.html