Skip to content

Commit 20ba5ae

Browse files
committed
Scale video attachments to 640px instead of AVFoundation's "medium"
The preset name is "640x480", but in practice it's "max longest dimension of 640", as tested on a widescreen vertical video. This is still better quality than "medium", which seems to be "longest dimension of 480".
1 parent 6ce5b07 commit 20ba5ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

SignalMessaging/attachments/SignalAttachment.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ public class SignalAttachment: NSObject {
10961096

10971097
public class func compressVideoAsMp4(asset: AVAsset, baseFilename: String?, dataUTI: String) -> (Promise<SignalAttachment>, AVAssetExportSession?) {
10981098
Logger.debug("")
1099-
guard let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPresetMediumQuality) else {
1099+
guard let exportSession = AVAssetExportSession(asset: asset, presetName: AVAssetExportPreset640x480) else {
11001100
let attachment = SignalAttachment(dataSource: DataSourceValue.emptyDataSource(), dataUTI: dataUTI)
11011101
attachment.error = .couldNotConvertToMpeg4
11021102
return (Promise.value(attachment), nil)
@@ -1169,7 +1169,7 @@ public class SignalAttachment: NSObject {
11691169
}
11701170

11711171
// It is a video, but it's not invalid
1172-
return false
1172+
return true
11731173
}
11741174

11751175
private class func isValidOutputVideo(dataSource: DataSource?, dataUTI: String) -> Bool {

0 commit comments

Comments
 (0)