diff --git a/dotfiles/local/bin/convert-libaom.sh b/dotfiles/local/bin/convert-libaom.sh index 3208dde..a8b0c4a 100755 --- a/dotfiles/local/bin/convert-libaom.sh +++ b/dotfiles/local/bin/convert-libaom.sh @@ -11,6 +11,7 @@ # - https://trac.ffmpeg.org/wiki/Encode/AV1 # # Changes: +# 2024-01-21: minor improvement to handling of output file name # 2022-06-13: use _max_crf in mkvpropedit if we don't find an acceptable vmaf # 2022-04-05: update VMAF log parsing # 2021-10-21: I tested 2-pass and found it doesn't do anything for constant @@ -53,15 +54,16 @@ elif [[ ! -r "$1" ]]; then exit 1 fi -INPUT_FILE_BASENAME=$(basename "$1") +INPUT_FILE_BASENAME=$(basename -- "$1") INPUT_FILE_EXTENSION=${INPUT_FILE_BASENAME##*.} -INPUT_FILE_DIRNAME=$(dirname "$1") +INPUT_FILE_DIRNAME=$(dirname -- "$1") # Check if an output file name was specified (like if we are calling from the # benchmarking script, in which case we want to exit as soon as possible). If # not then we can continue with a simple filename based on the input file's. if [[ -z $_output_file ]]; then - _output_file="${INPUT_FILE_BASENAME/.*/}.webm"; + # Strip file extension from end of string and replace with webm + _output_file="${INPUT_FILE_BASENAME%$INPUT_FILE_EXTENSION}webm"; _benchmark_mode="false" else _benchmark_mode="true"