Improve the compress video scripts

This commit is contained in:
2022-12-28 00:46:37 -05:00
parent c0dd5208a0
commit 0a7bb3c2a1
3 changed files with 33 additions and 58 deletions

View File

@@ -23,20 +23,25 @@ else
NORMAL=""
fi
use_gpu=$1
filename=$(basename -- "$2")
output_name="$3"
use_gpu=0
if [[ $use_gpu == "" || $2 == "" || $output_name == "" ]]; then
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <filename> <output name>${NORMAL}\n"
if [[ $# < 2 || $# > 3 ]]; then
printf "${BOLD}${RED}Usage: $0 <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> ${NORMAL}\n"
exit 1
fi
filename=$(basename -- "$1")
output_name="$2"
if [[ $# > 2 ]]; then
use_gpu=$3
fi
# Found the following to work best with vids containing text (e.g. programming vid): 25 for CPU encoding and 27 for GPU.
use_crf=21
if [[ $use_gpu -eq 1 ]]; then
use_crf=25
fi
compress-video-with-crf $use_gpu $use_crf "$filename" "$output_name"
compress-video-with-crf $use_crf "$filename" "$output_name" $use_gpu