From 0860db73ae6fd9a6f6347219d820bf026a6b8b91 Mon Sep 17 00:00:00 2001 From: Robert Günzler Date: Sun, 27 Sep 2026 17:38:39 +0200 Subject: * MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Automated-commit-by: dots Signed-off-by: Robert Günzler --- bin/2av1 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'bin/2av1') diff --git a/bin/2av1 b/bin/2av1 index 19ace0b..287323a 100755 --- a/bin/2av1 +++ b/bin/2av1 @@ -3,8 +3,13 @@ set -eu [ -n "${DEBUG:-}" ] && set -x [ -z "${DEBUG:-}" ] && export SVT_LOG=1 -BITRATE=${BITRATE:-128000} -EXT=${EXT:-webm} +: ${KEEP:=} +: ${OUTDIR:=} +: ${BITRATE:=128k} +: ${EXT:=webm} + +# expand +BITRATE=${BITRATE%k*}000 case "${VCODEC:-av1}" in vp9) vcodec_args=(-c:v libvpx-vp9 -crf "${CRF:-31}" -b:v 0) ;; @@ -76,6 +81,10 @@ for f in "$@"; do awk -v fs="$in_size" -v os="$out_size" \ 'BEGIN{p=((100/fs) * (fs-os)); printf("♻️ %.2f%% reduction\n", p);}' + if [ -n "$KEEP" ]; then + return + fi + if [ $in_size -gt $out_size ]; then trash-put -v "${f}" else -- cgit 1.4.1