Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Scale video based on minimum dimension instead of always height

Prateek Sunalf5005024c170
diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dart
index a1c5fd7103..75bec91866 100644
--- a/mobile/apps/photos/lib/services/video_preview_service.dart
+++ b/mobile/apps/photos/lib/services/video_preview_service.dart
@@ -448,8 +448,11 @@ class VideoPreviewService {
final videoFilters = <String>[];
if (rescaleVideo || needsTonemap) {
- // scale video to 720p or keep original height if less than 720p
- videoFilters.add("scale=-2:'min(720,ih)'");
+ // scale smaller dimension to 720p (or keep original if less than 720p)
+ // portrait: scale width to min(720,iw), landscape: scale height to min(720,ih)
+ videoFilters.add(
+ "scale='if(lt(iw,ih),min(720,iw),-2)':'if(lt(iw,ih),-2,min(720,ih))'",
+ );
// reduce fps to 30 if it is more than 30
if (applyFPS) videoFilters.add("fps=30");