summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Vivier <zaeph@zaeph.net>2022-12-02 08:14:02 +0100
committerLeo Vivier <zaeph@zaeph.net>2022-12-02 08:14:02 +0100
commit0fb08084d720946cac64b7fd7ee68c0864c29d6a (patch)
tree4fb18824d9397364bda639346355d105e1c6d642
parent56fba385b58c5aa076f5b162398641e5a27d5727 (diff)
downloademacsconf-ansible-0fb08084d720946cac64b7fd7ee68c0864c29d6a.tar.xz
emacsconf-ansible-0fb08084d720946cac64b7fd7ee68c0864c29d6a.zip
Add resolution limiter
-rwxr-xr-xroles/prerec/templates/reencode.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh
index e3a82eb..7ae3234 100755
--- a/roles/prerec/templates/reencode.sh
+++ b/roles/prerec/templates/reencode.sh
@@ -7,6 +7,7 @@ q=32
cpu=4
time_limit=""
print_only=false
+resolution=1080
while getopts :q:c:t:s OPT; do
case $OPT in
@@ -31,8 +32,8 @@ shift `expr $OPTIND - 1`
OPTIND=1
command="$(cat<<EOF
-ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -an -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -g 240 -pass 1 -f webm -threads $cpu /dev/null &&
- ffmpeg -y -i "$1" $time_limit -c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -pass 2 -g 240 -threads $cpu "$2"
+ffmpeg -y -i "$1" $time_limit -vf "scale='-1':'min($resolution,ih)'" -c:v libvpx-vp9 -b:v 0 -crf $q -an -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -g 240 -pass 1 -f webm -threads $cpu /dev/null &&
+ ffmpeg -y -i "$1" $time_limit -vf "scale='-1':'min($resolution,ih)'" -c:v libvpx-vp9 -b:v 0 -crf $q -c:a libopus -row-mt 1 -tile-columns 2 -tile-rows 2 -cpu-used $cpu -pass 2 -g 240 -threads $cpu "$2"
EOF
)"