|
@@ -66,7 +66,7 @@ class WSSMediaOperationTool: NSObject {
|
|
|
self?.imageVideoDecoder?.startProgressing()
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
func endImage2Video() {
|
|
|
if let imagedecoder = imageVideoDecoder {
|
|
|
imageVideoDecoder?.endProgressing()
|
|
@@ -119,16 +119,7 @@ extension WSSMediaOperationTool {
|
|
|
/// - Parameter videoAsset: 视频资源
|
|
|
/// - Returns: 视频质量
|
|
|
class func resolvePresentName(forVideoAsset videoAsset: AVAsset) -> String {
|
|
|
- var presentName: String = AVAssetExportPreset960x540
|
|
|
- let videoLength = videoAsset.duration.seconds
|
|
|
- if videoLength < 30.0 {
|
|
|
- presentName = AVAssetExportPresetHighestQuality
|
|
|
- } else if videoLength >= 30.0 && videoLength < 70.0 {
|
|
|
- presentName = AVAssetExportPreset1280x720
|
|
|
- } else {
|
|
|
- presentName = AVAssetExportPreset640x480
|
|
|
- }
|
|
|
- return presentName
|
|
|
+ return WSSCreativeTemplateConstant.getAdjustNormalPreset(videoAsset: videoAsset)
|
|
|
}
|
|
|
|
|
|
/// 计算裁剪时间范围
|
|
@@ -1563,16 +1554,16 @@ fileprivate extension WSSMediaOperationTool {
|
|
|
|
|
|
var newWidth: CGFloat
|
|
|
var newHeight: CGFloat
|
|
|
-
|
|
|
+
|
|
|
if videoRate > outputRate {
|
|
|
- //高对齐
|
|
|
- newHeight = outputSize.height
|
|
|
- newWidth = newHeight * videoRate
|
|
|
- }else {
|
|
|
- newWidth = outputSize.width
|
|
|
- newHeight = newWidth / videoRate
|
|
|
- }
|
|
|
-
|
|
|
+ // 高对齐
|
|
|
+ newHeight = outputSize.height
|
|
|
+ newWidth = newHeight * videoRate
|
|
|
+ } else {
|
|
|
+ newWidth = outputSize.width
|
|
|
+ newHeight = newWidth / videoRate
|
|
|
+ }
|
|
|
+
|
|
|
let widthScale = newWidth / videoSize.width
|
|
|
let heightScale = newHeight / videoSize.height
|
|
|
|
|
@@ -1639,4 +1630,3 @@ extension WSSMediaOperationTool {
|
|
|
case unkown = "未知错误"
|
|
|
}
|
|
|
}
|
|
|
-
|