You can decode your recorded video by this way :-
func encodeReocrdedVideoToH264(url:URL) {
let anAsset = AVAsset.init(url: url)// Your source AVAsset movie in HEVC format //
let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first
let outputURL = documentsURL?.appendingPathComponent("recording.mp4")
// These settings will encode using H.264.
let preset = AVAssetExportPresetHighestQuality
let outFileType = AVFileType.mov
AVAssetExportSession.determineCompatibility(ofExportPreset: preset, with: anAsset, outputFileType: outFileType) { (isCompatible) in
if !isCompatible {
print("AVAssetExportSession Not Compatible")
return
}
}
guard let export = AVAssetExportSession(asset: anAsset, presetName: preset) else {
return
}
export.outputFileType = outFileType
export.outputURL = outputURL
export.exportAsynchronously { () -> Void in
// Handle export results.
print("exportAsynchronously Succesuffully")
}
}
You can see your encoded video at outputURL.
For more information, please check Apple's doc