master
Marc Wäckerlin 8 years ago
parent 03de2a6669
commit 48645c73be
  1. 19
      scripts/convert-videos.sh

@ -4,12 +4,13 @@ SRC=${1:-.}
DST=${2:-/var/tmp/spielfilme}
declare -A FLAGS
FORMATS=( "ogg" "webm" "mp4" )
FORMATS=${FORMATS:-( "ogg" "webm" "mp4" )}
FLAGS["ogg"]="-c:v libtheora -c:a libvorbis -q:v 6 -q:a 5"
FLAGS["webm"]="-vcodec libvpx -acodec libvorbis -f webm -aq 5 -ac 2 -qmax 25 -threads 2"
FLAGS["mp4"]="-vcodec libx264 -acodec aac -strict experimental -crf 19"
for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do
do_convert() {
f="$1"
for format in "${FORMATS[@]}"; do
t="${f/$SRC/$DST}"
t="${t%.*}.${format}"
@ -25,4 +26,16 @@ for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type
rm "$t"; # remove file if conversion failed
fi
done
done
}
if test -d "$SRC"; then
for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do
do_convert "$1"
done
else
IFS="
"
for f in $SRC; do
do_convert "$1"
done
fi

Loading…
Cancel
Save