Hi I am trying to export a video file with size near about 800 MB using AVAssetExportSession which is taking nearly 2-3 mins for completing the process. I have tried by setting the export session preset as AVAssetExportPresetPassthrough, AVAssetExportPresetHighestQuality and others too for try out but didn't work for me as required. Is there any way out over this?
For more details I have given my code following :
let defaultRep = PHImageManager.default()
let str = "\(UIDevice.current.identifierForVendor!.uuidString).mov"
url = url.appendingPathComponent(str)
defaultRep.requestExportSession(forVideo: self.phasset, options: PHVideoRequestOptions?.none, exportPreset: AVAssetExportPresetPassthrough, resultHandler: { (exportSession, info) -> Void in
guard let exportSession = exportSession
else {
if let error = info?[PHImageErrorKey] as? NSError {
} else {
}
return
}
exportSession.outputFileType = AVFileTypeQuickTimeMovie
exportSession.shouldOptimizeForNetworkUse = true
let str = "\(UIDevice.current.identifierForVendor!.uuidString).mov"
url = url.appendingPathComponent(str)
self.removeFile(url)
exportSession.outputURL = url as URL
exportSession.exportAsynchronously(completionHandler: { () -> Void in
switch exportSession.status{
case .completed :
print("Complete")
print(exportSession.outputURL)
print(self.phasset.pixelWidth)
print(self.phasset.pixelHeight)
self.mediaType = SBMediaType.SBMediaTypeVideo
self.videoUrl = exportSession.outputURL
withCompletionhandler(self)
break
case .cancelled:
print("cancelled")
if let error = exportSession.error {
print(error)
}
break
case .exporting:
print("Exporting")
if let error = exportSession.error {
print(error)
}
break
case .failed:
print("Exporting")
if let error = exportSession.error {
print(error)
}
break
case .waiting:
print("Waiting")
if let error = exportSession.error {
print(error)
}
break
default :
break
}
})
})