From a0e8a535be2b870eafa8feecde003d98c638bcb2 Mon Sep 17 00:00:00 2001 From: Leo Vivier Date: Sat, 5 Nov 2022 08:32:16 +0100 Subject: =?UTF-8?q?Use=20latest=20version=20of=20zaeph=E2=80=99s=20reencod?= =?UTF-8?q?e.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - cpu set to 4 for parallelization (> 4 doesn’t work) - add getopts option for development --- roles/prerec/templates/reencode.sh | 48 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-) mode change 100644 => 100755 roles/prerec/templates/reencode.sh diff --git a/roles/prerec/templates/reencode.sh b/roles/prerec/templates/reencode.sh old mode 100644 new mode 100755 index d0c98c3..e3a82eb --- a/roles/prerec/templates/reencode.sh +++ b/roles/prerec/templates/reencode.sh @@ -1,5 +1,43 @@ -Q=32 -CPU=8 -TIME_LIMIT='' -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" +#!/usr/bin/env bash + +set -euo pipefail + +# Defaults +q=32 +cpu=4 +time_limit="" +print_only=false + +while getopts :q:c:t:s OPT; do + case $OPT in + q|+q) + q="$OPTARG" + ;; + c|+c) + cpu="$OPTARG" + ;; + t|+t) + time_limit="-to $OPTARG" + ;; + s) + print_only=true + ;; + *) + echo "usage: `basename $0` [+-q ARG] [+-c ARG} [--] ARGS..." + exit 2 + esac +done +shift `expr $OPTIND - 1` +OPTIND=1 + +command="$(cat<