early structure
This commit is contained in:
parent
56d13bcea9
commit
07fa20195e
1 changed files with 58 additions and 0 deletions
58
to_vp9.sh
Normal file
58
to_vp9.sh
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# set shopt-options used by this shell-script
|
||||||
|
# Note, 0 (true) from shopt -q is "false" in a math context.
|
||||||
|
shopt -q globstar; globstar_set=$?
|
||||||
|
((globstar_set)) && shopt -s globstar
|
||||||
|
shopt -q extglob; extglob_set=$?
|
||||||
|
((extglob_set)) && shopt -s extglob
|
||||||
|
|
||||||
|
# return default shopt-options
|
||||||
|
function finish {
|
||||||
|
((globstar_set)) && shopt -u globstar
|
||||||
|
((extglob_set)) && shopt -u extglob
|
||||||
|
}
|
||||||
|
trap finish EXIT
|
||||||
|
|
||||||
|
print_help() {
|
||||||
|
printf "Help: not implemented yet"
|
||||||
|
}
|
||||||
|
|
||||||
|
while getopts 'e:dh' flag; do
|
||||||
|
case "${flag}" in
|
||||||
|
e) extension+=("$OPTARG");;
|
||||||
|
d) delete=true;;
|
||||||
|
h) print_help
|
||||||
|
exit 0;;
|
||||||
|
*) exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Print available encoders
|
||||||
|
readarray -t encoders <<<$(ffmpeg -encoders -hide_banner|grep vp9)
|
||||||
|
echo "In FFMPEG verfügbare Encoder:"
|
||||||
|
for i in "${!encoders[@]}"; do
|
||||||
|
echo "$i: ${encoders[i]}"
|
||||||
|
#encoders[i]=$(echo ${encoders[0]} | awk '{print $2}')
|
||||||
|
done
|
||||||
|
|
||||||
|
# Choose an encoder
|
||||||
|
while :; do
|
||||||
|
read -p "Choose an encoder [0]: " encoder
|
||||||
|
[[ $encoder =~ ^[0-9]+$ ]] || { echo "Enter a valid number"; continue; }
|
||||||
|
if ((encoder >= 0 && encoder < ${#encoders[@]})); then
|
||||||
|
encoder=$(echo ${encoders[$encoder]} | awk '{print $2}')
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "number out of range, try again"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# write array into string
|
||||||
|
extension="${extension[*]}"
|
||||||
|
# change separator
|
||||||
|
extension=${extension// /|}
|
||||||
|
|
||||||
|
for file in **/*.@($extension); do
|
||||||
|
echo $encoder
|
||||||
|
done
|
Loading…
Reference in a new issue