From b9fdae5d678fd00ff420c8fa7b4fbf06298aeb1c Mon Sep 17 00:00:00 2001
From: Leo Vivier <zaeph@zaeph.net>
Date: Fri, 2 Dec 2022 08:34:04 +0100
Subject: Use variables for input and output

---
 roles/prerec/templates/reencode.sh | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'roles/prerec')

diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh
index 66c2f57..5a0128b 100755
--- a/roles/prerec/templates/reencode.sh
+++ b/roles/prerec/templates/reencode.sh
@@ -32,19 +32,22 @@ done
 shift `expr $OPTIND - 1`
 OPTIND=1
 
+input="$1"
+output="$2"
+
 command="$(cat<<EOF
-ffmpeg -y -i "$1" $time_limit \
+ffmpeg -y -i "$input" $time_limit \
        -vf "scale='-1':'min($limit_resolution,ih)',
             select='eq(n,0)+if(gt(t-prev_selected_t,1/$limit_fps),1,0)'" \
        -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 \
+    ffmpeg -y -i "$input" $time_limit \
            -vf "scale='-1':'min($limit_resolution,ih)',
                 select='eq(n,0)+if(gt(t-prev_selected_t,1/$limit_fps),1,0)'" \
-           -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 -threads $cpu "$2"
+               -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 -threads $cpu -- "$output"
 EOF
 )"
 
-- 
cgit v1.2.3