Improve the compress video scripts
This commit is contained in:
@@ -23,22 +23,36 @@ else
|
||||
NORMAL=""
|
||||
fi
|
||||
|
||||
use_gpu=$1
|
||||
use_crf=$2
|
||||
output_name="$4"
|
||||
start_time="$5"
|
||||
end_time="$6"
|
||||
use_gpu=0
|
||||
|
||||
if [[ $use_gpu == "" || $use_crf == "" || $3 == "" || $output_name == "" || ($start_time != "" && $end_time == "") ]]; then
|
||||
printf "${BOLD}${RED}Usage: $0 <use-gpu (1|0)> <crf value> <filename> <output name> <optional start time HH:MM:SS> <optional end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
|
||||
if [[ "$#" < 3 || "$#" > 6 ]]; then
|
||||
printf "${BOLD}${RED}Usage: $0 <crf value> <filename> <output name> <optional: use-gpu (1|0), defaults to $use_gpu> <optional: start time HH:MM:SS> <optional: end time HH:MM:SS>\n\nIf you want to encode a range of CRF values then use -1 as the crf value.${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
use_crf=$1
|
||||
|
||||
filename=$(basename -- "$3")
|
||||
filename=$(basename -- "$2")
|
||||
extension="${filename##*.}"
|
||||
filename="${filename%.*}"
|
||||
|
||||
output_name="$3"
|
||||
|
||||
if [[ "$#" > 3 ]]; then
|
||||
use_gpu=$4
|
||||
if [[ "$#" > 4 ]]; then
|
||||
start_time="$5"
|
||||
if [[ "$#" > 5 ]]; then
|
||||
end_time="$6"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $use_gpu -ne 0 && $use_gpu -ne 1 ]]; then
|
||||
printf "${BOLD}${RED}Invalid use_gpu value. Got $use_gpu, but expected either 0 or 1${NORMAL}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function encode() {
|
||||
crf=$1
|
||||
output="${output_name}.$extension"
|
||||
|
||||
Reference in New Issue
Block a user