mirror of
https://github.com/levogevo/ffmpeg-av1-builder.git
synced 2026-01-15 16:56:18 +00:00
simpler
This commit is contained in:
@@ -1,21 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "estimate_fg.sh -i input_file"
|
echo "estimate_fg.sh -i input_file [-I] [-U]"
|
||||||
|
echo -e "\t-I Install this as /usr/local/bin/estimate-film-grain [optional]"
|
||||||
|
echo -e "\t-U Uninstall this from /usr/local/bin/estimate-film-grain [optional]"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
OPTS='i:'
|
OPTS='i:IU'
|
||||||
NUM_OPTS="${#OPTS}"
|
NUM_OPTS="${#OPTS}"
|
||||||
# only using -i
|
# only using -i
|
||||||
MIN_OPT=$NUM_OPTS
|
MIN_OPT=1
|
||||||
# using all
|
# using all
|
||||||
MAX_OPT=$NUM_OPTS
|
MAX_OPT=$NUM_OPTS
|
||||||
test "$#" -lt "$MIN_OPT" && echo "not enough arguments" && usage && exit 1
|
test "$#" -lt "$MIN_OPT" && echo "not enough arguments" && usage && exit 1
|
||||||
test "$#" -gt "$MAX_OPT" && echo "too many arguments" && usage && exit 1
|
test "$#" -gt "$MAX_OPT" && echo "too many arguments" && usage && exit 1
|
||||||
while getopts "$OPTS" flag; do
|
while getopts "$OPTS" flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
|
I)
|
||||||
|
echo "attempting install"
|
||||||
|
sudo ln -sf "$(pwd)/scripts/estimate_fg.sh" \
|
||||||
|
/usr/local/bin/estimate-film-grain || exit 1
|
||||||
|
echo "succesfull install"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
U)
|
||||||
|
echo "attempting uninstall"
|
||||||
|
sudo rm /usr/local/bin/estimate-film-grain || exit 1
|
||||||
|
echo "succesfull uninstall"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
i)
|
i)
|
||||||
|
if [[ $# -lt 2 ]]; then
|
||||||
|
echo "wrong arguments given"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
INPUT="${OPTARG}"
|
INPUT="${OPTARG}"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
# do not take this as a holy grail.
|
# do not take this as a holy grail.
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "encode -i input_file [-p true/false] [-g NUM] [output_file_name]"
|
echo "encode -i input_file [-p true/false] [-g NUM] [output_file_name] [-I] [-U]"
|
||||||
echo -e "\t-p print the command instead of executing it [optional]"
|
echo -e "\t-p print the command instead of executing it [optional]"
|
||||||
echo -e "\t-g set film grain for encode [optional]"
|
echo -e "\t-g set film grain for encode [optional]"
|
||||||
echo -e "\toutput_file_name if not set, will create at $HOME/ [optional]"
|
echo -e "\toutput_file_name if not set, will create at $HOME/ [optional]"
|
||||||
|
echo -e "\t-I Install this as /usr/local/bin/encode [optional]"
|
||||||
|
echo -e "\t-U Uninstall this from /usr/local/bin/encode [optional]"
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,19 +107,37 @@ get_bitrate_audio() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
OPTS='i:p:g:'
|
OPTS='i:p:g:IU'
|
||||||
NUM_OPTS="${#OPTS}"
|
NUM_OPTS="${#OPTS}"
|
||||||
PRINT_OUT="false"
|
PRINT_OUT="false"
|
||||||
GRAIN=""
|
GRAIN=""
|
||||||
# only using -i
|
# only using -I/U
|
||||||
MIN_OPT=2
|
MIN_OPT=1
|
||||||
# using all + output name
|
# using all + output name
|
||||||
MAX_OPT=$(( NUM_OPTS + 1 ))
|
MAX_OPT=$(( NUM_OPTS + 1 ))
|
||||||
test "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1
|
test "$#" -lt $MIN_OPT && echo "not enough arguments" && usage && exit 1
|
||||||
test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1
|
test "$#" -gt $MAX_OPT && echo "too many arguments" && usage && exit 1
|
||||||
while getopts "$OPTS" flag; do
|
while getopts "$OPTS" flag; do
|
||||||
case "${flag}" in
|
case "${flag}" in
|
||||||
|
I)
|
||||||
|
echo "attempting install"
|
||||||
|
sudo ln -sf "$(pwd)/scripts/recc_encode.sh" \
|
||||||
|
/usr/local/bin/encode || exit 1
|
||||||
|
echo "succesfull install"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
U)
|
||||||
|
echo "attempting uninstall"
|
||||||
|
sudo rm /usr/local/bin/encode || exit 1
|
||||||
|
echo "succesfull uninstall"
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
i)
|
i)
|
||||||
|
if [[ $# -lt 2 ]]; then
|
||||||
|
echo "wrong arguments given"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
INPUT="${OPTARG}"
|
INPUT="${OPTARG}"
|
||||||
;;
|
;;
|
||||||
p)
|
p)
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
sudo ln -sf "$(pwd)/scripts/recc_encode.sh" /usr/local/bin/encode
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
sudo rm /usr/local/bin/encode
|
|
||||||
Reference in New Issue
Block a user