iOS 9 UIImagePickerController视频模式模糊

时间:2015-11-20 09:31:44

标签: ios video camera uiimagepickercontroller ios9

我正在使用UIImagePickerController来捕捉视频并存储它。当我尝试使用静态图像捕获时,一切正常,但是当我在视频模式下打开UIImagePickerController时,图片总是有点模糊。当我尝试聚焦不同的物体时,我看到焦点发生了变化,但它仍然有点模糊(所以永远不会真正对焦)。这是iOS 9的已知问题吗?我还尝试了一些来自互联网的示例项目,但结果相同。我尝试使用iPhone 6siPhone 6

这是我使用的代码:

    func actionSheet(sheet: ActionSheet, didSelectOption option: Int) {

    let picker = UIImagePickerController()
    picker.delegate = self
    picker.navigationBar.tintColor = UIColor.whiteColor()

    let statusView = UIView(frame: UIApplication.sharedApplication().statusBarFrame)
    statusView.y = (-(UIApplication.sharedApplication().statusBarFrame.height))
    statusView.backgroundColor = colorBlue
    picker.navigationBar.insertSubview(statusView, atIndex: 1)


    if sheet.tag == actionSheetTagTakePicture {
        picker.allowsEditing = true
        picker.sourceType = option == 1 ? .Camera : .PhotoLibrary
        if option == 1 {
            picker.cameraDevice = .Front
        }
    }
    else {
        picker.mediaTypes = [kUTTypeMovie as String]
        picker.sourceType = option == 1 ? .Camera : .SavedPhotosAlbum
        if option == 1 {
            picker.cameraDevice = UIImagePickerControllerCameraDevice.Rear

            picker.cameraDevice = .Rear
            picker.cameraCaptureMode = .Video
        }
    }
    self.presentViewController(picker, animated: true, completion: nil)

}

1 个答案:

答案 0 :(得分:4)

好的,事实证明.videoQuality的默认设置为.TypeMedium。结果导致:

  • 视频尺寸为4:3
  • 大型显示屏上的视频质量不佳 - >所以它看起来很模糊(或实际上是因为质量差)

我改变了这样的设置:

picker.videoQuality = .TypeIFrame960x540

现在一切正常,视频也是16:9