imaginary-cloud / CameraManager

Simple Swift class to provide all the configurations you need to create custom camera view in your app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

back camera flickers and auto refocuses itself when recording in higher quality than medium (already removed location meta data)

kselvin opened this issue · comments

It only happens on the first recording, then it won't happen for the rest of the capture session

Video stabilisation does this issue in my case on iPhone 6s. You can try remove these lines or put it elsewhere. I am not sure if it'll help you, but video recording works well for me after that.

open func startRecordingVideo() {
    if cameraOutputMode != .stillImage {
        let videoOutput = _getMovieOutput()
        // setup video mirroring
        
        for connection in movieOutput!.connections {
            for port in connection.inputPorts {
                
                if port.mediaType == AVMediaType.video {
                    let videoConnection = connection as AVCaptureConnection
                    if videoConnection.isVideoMirroringSupported {
                        videoConnection.isVideoMirrored = (cameraDevice == CameraDevice.front && shouldFlipFrontCameraImage)
                    }
                    
//                        This cause auto refocuses ... 
//                        if videoConnection.isVideoStabilizationSupported {
//                            videoConnection.preferredVideoStabilizationMode = self.videoStabilisationMode
//                        }
                }
            }
        }

        _updateIlluminationMode(flashMode)
        
        videoOutput.startRecording(to: _tempFilePath(), recordingDelegate: self)
    } else {
        _show(NSLocalizedString("Capture session output still image", comment:""), message: NSLocalizedString("I can only take pictures", comment:""))
    }
}

Thanks! That worked on my iPhone X.

I am also working with an iPad trying to shoot in 4k where the problem still persists after commenting out the video stabilization code. I think shooting in 4k resolution probably has something to do with it

Do you have some code to reproduce this? Thanks.

The issue is only noticeable when recording in high resolution. I commented the video stabilization lines but no luck, the issue still happening in my iPhone X.

Fixed in the latest version