美文网首页
[swift] mov格式转mp4格式

[swift] mov格式转mp4格式

作者: KKKKaras | 来源:发表于2018-02-28 22:45 被阅读317次
     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格式

          本文链接:https://www.haomeiwen.com/subject/dlkwxftx.html