From 2aedc3e86195c01c4faf3e0baaa5d4bbc9cb78b5 Mon Sep 17 00:00:00 2001
From: veselcraft <veselcraft@icloud.com>
Date: Wed, 4 Dec 2024 16:26:03 +0300
Subject: [PATCH] fix(video): instead of scailing it down to 4:3 with black
 bars scale it by 480px

---
 Web/Models/shell/processVideo.ps1 | 2 +-
 Web/Models/shell/processVideo.sh  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Web/Models/shell/processVideo.ps1 b/Web/Models/shell/processVideo.ps1
index f2cc9918..59f53c72 100644
--- a/Web/Models/shell/processVideo.ps1
+++ b/Web/Models/shell/processVideo.ps1
@@ -13,7 +13,7 @@ Move-Item $file $temp
 
 # video stub logic was implicitly deprecated, so we start processing at once
 ffmpeg -i $temp -ss 00:00:01.000 -vframes 1 "$dir$hashT/$hash.gif"
-ffmpeg -i $temp -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -vf "scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1" -y $temp2
+ffmpeg -i $temp -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -vf "scale=480:-1,setsar=1" -y $temp2
 
 Move-Item $temp2 "$dir$hashT/$hash.mp4"
 Remove-Item $temp
diff --git a/Web/Models/shell/processVideo.sh b/Web/Models/shell/processVideo.sh
index ca2c6d99..f906544d 100644
--- a/Web/Models/shell/processVideo.sh
+++ b/Web/Models/shell/processVideo.sh
@@ -3,7 +3,7 @@ tmpfile="$RANDOM-$(date +%s%N)"
 cp $2 "/tmp/vid_$tmpfile.bin"
 
 nice ffmpeg -i "/tmp/vid_$tmpfile.bin" -ss 00:00:01.000 -vframes 1 $3${4:0:2}/$4.gif
-nice -n 20 ffmpeg -i "/tmp/vid_$tmpfile.bin" -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -vf "scale=640:480:force_original_aspect_ratio=decrease,pad=640:480:(ow-iw)/2:(oh-ih)/2,setsar=1" -y "/tmp/ffmOi$tmpfile.mp4"
+nice -n 20 ffmpeg -i "/tmp/vid_$tmpfile.bin" -c:v libx264 -q:v 7 -c:a libmp3lame -q:a 4 -tune zerolatency -vf "scale=480:-1,setsar=1" -y "/tmp/ffmOi$tmpfile.mp4"
 
 rm -rf $3${4:0:2}/$4.mp4
 mv "/tmp/ffmOi$tmpfile.mp4" $3${4:0:2}/$4.mp4