|
@@ -1772,32 +1772,33 @@ extension PQStuckPointPublicController {
|
|
|
userNameFontSize = Float(self.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0) * 70.0 / 1080.0
|
|
|
}
|
|
|
|
|
|
- let subtitleInfo:PQEditSubtitleInfoModel = PQEditSubtitleInfoModel.init()
|
|
|
- subtitleInfo.fontSize = Int(userNameFontSize)
|
|
|
- subtitleInfo.text = BFLoginUserInfo.shared.nickName
|
|
|
- userNameSticker.subtitleInfo = subtitleInfo
|
|
|
-
|
|
|
- let userNamePostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init()
|
|
|
- userNamePostion.width = Int(userNameFontSize ) * 10
|
|
|
- userNamePostion.height = Int(userNameFontSize ) * 3
|
|
|
- userNamePostion.x = ((self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) - userNamePostion.width) / 2
|
|
|
- userNamePostion.y = Int(userNameTop)
|
|
|
- userNameSticker.materialPosition = userNamePostion
|
|
|
-
|
|
|
-
|
|
|
- let soundResPath = currentBundlePath()!.path(forResource: "endMovieSound", ofType: "mp3")
|
|
|
- let soundAsset = AVURLAsset(url: URL(fileURLWithPath: soundResPath ?? ""), options: nil)
|
|
|
- self.endMovieExporter = PQCompositionExporter(asset: soundAsset, videoComposition: nil, audioMix: nil, filters: nil, stickers: [bgMovieInfo,avatarSticker,userNameSticker], animationTool: nil, exportURL: outPutMP4URL)
|
|
|
- self.endMovieExporter.isEndMovie = true
|
|
|
- if self.endMovieExporter.prepare(videoSize: CGSize(width: self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: self.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0), videoAverageBitRate: orgeBitRate) {
|
|
|
-
|
|
|
- self.endMovieExporter.start(playeTimeRange: CMTimeRange.init(start: CMTime.zero, duration: CMTimeMakeWithSeconds(Float64(bgMovieInfo.out), preferredTimescale: BASE_FILTER_TIMESCALE)))
|
|
|
- BFLog(message: "开始导出")
|
|
|
- }
|
|
|
- self.endMovieExporter.progressClosure = { _, _, progress in
|
|
|
- BFLog(message: "片尾合成进度 \(progress) ")
|
|
|
-
|
|
|
- }
|
|
|
+ let subtitleInfo:PQEditSubtitleInfoModel = PQEditSubtitleInfoModel.init()
|
|
|
+ subtitleInfo.fontSize = Int(userNameFontSize)
|
|
|
+ subtitleInfo.text = BFLoginUserInfo.shared.nickName
|
|
|
+ userNameSticker.subtitleInfo = subtitleInfo
|
|
|
+
|
|
|
+ let userNamePostion:PQEditMaterialPositionModel = PQEditMaterialPositionModel.init()
|
|
|
+ userNamePostion.width = Int(userNameFontSize ) * 10
|
|
|
+ userNamePostion.height = Int(userNameFontSize ) * 3
|
|
|
+ userNamePostion.x = ((self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0) - userNamePostion.width) / 2
|
|
|
+ userNamePostion.y = Int(userNameTop)
|
|
|
+ userNameSticker.materialPosition = userNamePostion
|
|
|
+
|
|
|
+
|
|
|
+ let soundResPath = currentBundlePath()!.path(forResource: "endMovieSound", ofType: "mp3")
|
|
|
+ let soundAsset = AVURLAsset(url: URL(fileURLWithPath: soundResPath ?? ""), options: nil)
|
|
|
+ self.endMovieExporter = PQCompositionExporter(asset: soundAsset, videoComposition: nil, audioMix: nil, filters: nil, stickers: [bgMovieInfo,avatarSticker,userNameSticker], animationTool: nil, exportURL: outPutMP4URL)
|
|
|
+ self.endMovieExporter.isEndMovie = true
|
|
|
+ if self.endMovieExporter.prepare(videoSize: CGSize(width: self.editProjectModel?.sData?.videoMetaData?.videoWidth ?? 0, height: self.editProjectModel?.sData?.videoMetaData?.videoHeight ?? 0), videoAverageBitRate: orgeBitRate) {
|
|
|
+
|
|
|
+ self.endMovieExporter.start(playeTimeRange: CMTimeRange.init(start: CMTime.zero, duration: CMTimeMakeWithSeconds(Float64(bgMovieInfo.out), preferredTimescale: BASE_FILTER_TIMESCALE)))
|
|
|
+ BFLog(message: "开始导出")
|
|
|
+ }
|
|
|
+ self.endMovieExporter.progressClosure = { _, _, progress in
|
|
|
+ BFLog(message: "片尾合成进度 \(progress) ")
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
self.endMovieExporter.completion = { [weak self] url in
|
|
|
BFLog(message: "片尾的视频导出完成: \(String(describing: url)) 生成视频时长为:\(CMTimeGetSeconds(AVAsset(url: url ?? URL(string: "https:
|
|
|
|