[swift] mov格式转mp4格式

 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))”)
        })

你可能感兴趣的:([swift] mov格式转mp4格式)