Browse Source

快速段结尾时都不丢素材,防止特别小的视频 都别大的倍速时 整个视频都被丢掉

jsonwang 3 years ago
parent
commit
5ee11bec23

+ 6 - 8
BFFramework/Classes/Stuckpoint/Controller/PQStuckPointEditerController.swift

@@ -1299,12 +1299,10 @@ extension PQStuckPointEditerController {
                                             let pointDuration = timelineOut - tempTimelineIn
                                             let pointDuration = timelineOut - tempTimelineIn
                                             // 要适应到卡点内要使用的C速度
                                             // 要适应到卡点内要使用的C速度
                                             let needSpeed = lastAssetDuration / pointDuration
                                             let needSpeed = lastAssetDuration / pointDuration
-                                            // 当前卡点段为快速
+                                            // 当前卡点段为快速 快速都 C 速处理
                                             if tempSpeed >= 1 {
                                             if tempSpeed >= 1 {
                                                 if needSpeed >= 0.4 * Double(tempSpeed) {
                                                 if needSpeed >= 0.4 * Double(tempSpeed) {
                                                     deepCopySticker?.speedRate = Float(needSpeed)
                                                     deepCopySticker?.speedRate = Float(needSpeed)
-                                                } else {
-                                                    continue
                                                 }
                                                 }
                                             } else { // 当前卡点段为慢速
                                             } else { // 当前卡点段为慢速
                                                 if needSpeed >= 0.4 * Double(tempSpeed) && needSpeed >= 0.2 {
                                                 if needSpeed >= 0.4 * Double(tempSpeed) && needSpeed >= 0.2 {
@@ -1571,7 +1569,7 @@ extension PQStuckPointEditerController {
                                 // 下一个卡的的速度性质快、慢,e.g. sticker.clipCount = 5时 tempSpeed 应该是慢速。下面计算正确。
                                 // 下一个卡的的速度性质快、慢,e.g. sticker.clipCount = 5时 tempSpeed 应该是慢速。下面计算正确。
                                 var tempSpeed: Float = 1.0
                                 var tempSpeed: Float = 1.0
                                 if model == .createStickersModelSpeed {
                                 if model == .createStickersModelSpeed {
-                                    tempSpeed = (sticker.clipCount) % 2 == 0 ? modelSpeed_maxSpeed : modelSpeed_minSpeed
+                                    tempSpeed = (sticker.clipCount) % 2 != 0 ? modelSpeed_maxSpeed : modelSpeed_minSpeed
                                 }
                                 }
                                 // 最后一点素材时长
                                 // 最后一点素材时长
                                 let lastAssetDuration = Float(CMTimeGetSeconds(asset.duration)) - useAssestDurationTemp
                                 let lastAssetDuration = Float(CMTimeGetSeconds(asset.duration)) - useAssestDurationTemp
@@ -1587,10 +1585,10 @@ extension PQStuckPointEditerController {
                                     let needSpeed = lastAssetDuration / pointDuration
                                     let needSpeed = lastAssetDuration / pointDuration
                                     // 当前卡点段为快速
                                     // 当前卡点段为快速
                                     if tempSpeed >= 1 {
                                     if tempSpeed >= 1 {
-                                        if needSpeed < 0.4 * tempSpeed {
-                                            BFLog(message: "条件不满足不用补位 删除多加的一位")
-                                            finallyStuckPoints.removeLast()
-                                        }
+//                                        if needSpeed < 0.4 * tempSpeed {
+//                                            BFLog(message: "条件不满足不用补位 删除多加的一位")
+//                                            finallyStuckPoints.removeLast()
+//                                        }
                                     } else { // 当前卡点段为慢速
                                     } else { // 当前卡点段为慢速
                                         if needSpeed >= 0.4 * tempSpeed && needSpeed >= 0.2 {
                                         if needSpeed >= 0.4 * tempSpeed && needSpeed >= 0.2 {
                                             // 查找使用的最后一个卡点在原数组中的位置
                                             // 查找使用的最后一个卡点在原数组中的位置