如何将video.mp4与audio.mp4合并?
我使用Swift App下载Reddit视频
Videos downloading without sound
我想要代码将video.mp4与audio.mp4合并
或
将audio.mp4转换为audio.mp3
答案 0 :(得分:0)
您可以将audio.mp4转换为audio.mp3
let audioURL = ""
let outputUrl = ""
let asset = AVAsset.init(url: audioURL)
let exportSession = AVAssetExportSession.init(asset: asset, presetName: AVAssetExportPresetHighestQuality
exportSession?.outputFileType = AVFileTypeMPEGLayer3
exportSession?.outputURL = outputUrl
exportSession?.metadata = asset.metadata
exportSession?.exportAsynchronously(completionHandler: {
if (exportSession?.status == .completed)
{
print("succees")
}
else if (exportSession?.status == .cancelled)
{
print("cancelled.")
}
else
{
print ("Error is \(String(describing: exportSession?.error))")
}
})