let avAsset = AVURLAsset.init(url: outputFileURL, options: nil)
let tracks:NSArray = avAsset.tracks(withMediaType: AVMediaType.video) as NSArray
let destinationPath = NSTemporaryDirectory() + fileName.mp4”
let newVideoPath: NSURL = NSURL(fileURLWithPath: destinationPath as String)
let exporter = AVAssetExportSession(asset: avAsset,
presetName:AVAssetExportPresetHighestQuality)!
exporter.outputURL = newVideoPath as URL
exporter.outputFileType = AVFileType.mp4
exporter.shouldOptimizeForNetworkUse = true
exporter.exportAsynchronously(completionHandler: {
print(“NewPath:\(String(describing: newVideoPath.relativePath))”)
})
网友评论