Awalz / SwiftyCam

A Snapchat Inspired iOS Camera Framework written in Swift
BSD 2-Clause "Simplified" License
2.08k stars 327 forks source link

iPhone X , .h264, HEVC issue Video Converter #208

Open ShaikBaji1506 opened 5 years ago

ShaikBaji1506 commented 5 years ago

iPhone X device when we record the video the video is converting into the .h264 which is default but where as for iPhone X, it is taking as codeC type as HEVC and I have changed my code to

if #available(iOS 11.0, *) { let connection = movieFileOutput.connection(with: .video) if movieFileOutput.availableVideoCodecTypes.contains(.h264)

        {
// Use the H.264 codec to encode the video.
 movieFileOutput.setOutputSettings([AVVideoCodecKey:AVVideoCodecType.h264], for: connection!)
        }
        }

this is really superb but the issue is when I give my default camera to = .front in viewDidLoad,then for front camera video recorded it is going as .h264 codeC and when I switch the camera to rear and record the video then at that time it is going as hevc but not as .h264

the same when in set my default camera to = .rear in viewDidLoad,then for rear camera video recorded it is going as .h264 codeC and when I switch the camera to front and record the video then at that time it is going as hevc but not as .h264 why this is behaving like this ??

what is this thing happening too I was unable to know one more thing I have given default camera to rear or front but some times it is coming according to my requirement but not all times what is this issue