|
@@ -447,7 +447,7 @@ public class BFRecordExport {
|
|
|
|
|
|
// 有录音操作或者多个视频,就会进入合成步骤,否则就是一个没有处理的素材,直接导出就行了
|
|
|
if voiceCount > 0 || videoStickers.count > 1 {
|
|
|
- let (audioMix, composition) = mergeAudio(videoStickers: videoStickers, audios: voiceList, synthesisAll: synthesisAll)
|
|
|
+ let (audioMix, composition) = mergeAudio(videoStickers: videoStickers, audios: voiceList, synthesisAll: synthesisAll, totalDur: totalDuration)
|
|
|
|
|
|
let outputSize: CGSize = CGSize(width: 1080, height: Int(1080 * CGFloat(UIScreen.main.bounds.size.height / UIScreen.main.bounds.size.width)))
|
|
|
BFLog(message: "输出视频大小:\(outputSize)")
|
|
@@ -543,7 +543,7 @@ public class BFRecordExport {
|
|
|
}
|
|
|
|
|
|
extension BFRecordExport {
|
|
|
- func mergeAudio(videoStickers: [PQEditVisionTrackMaterialsModel], audios: [PQEditVisionTrackMaterialsModel]?, synthesisAll: Bool) -> (AVMutableAudioMix, AVMutableComposition) {
|
|
|
+ func mergeAudio(videoStickers: [PQEditVisionTrackMaterialsModel], audios: [PQEditVisionTrackMaterialsModel]?, synthesisAll: Bool, totalDur:Double) -> (AVMutableAudioMix, AVMutableComposition) {
|
|
|
let composition = AVMutableComposition()
|
|
|
let audioMix = AVMutableAudioMix()
|
|
|
var tempParameters = [AVMutableAudioMixInputParameters]()
|
|
@@ -570,7 +570,7 @@ extension BFRecordExport {
|
|
|
BFLog(message: "合成视频总时长:\(composition.duration.seconds)")
|
|
|
if bgmModel != nil, bgmModel?.wavFilePath != nil {
|
|
|
bgmModel?.startTime = bgmModel?.currentTime ?? 0.0
|
|
|
- let bgmParameters = PQPlayerViewModel.dealWithBGMTrack(bgmData: bgmModel!, totalDuration: composition.duration.seconds, composition: composition)
|
|
|
+ let bgmParameters = PQPlayerViewModel.dealWithBGMTrack(bgmData: bgmModel!, totalDuration: totalDur, composition: composition)
|
|
|
if bgmParameters.count > 0 {
|
|
|
tempParameters += bgmParameters
|
|
|
}
|