|
|
@ -3,16 +3,16 @@ |
|
|
|
SRC=${1:-.} |
|
|
|
SRC=${1:-.} |
|
|
|
DST=${2:-/var/tmp/spielfilme} |
|
|
|
DST=${2:-/var/tmp/spielfilme} |
|
|
|
|
|
|
|
|
|
|
|
FORMATS="ogg webm mp4" |
|
|
|
|
|
|
|
declare -A FLAGS |
|
|
|
declare -A FLAGS |
|
|
|
|
|
|
|
FORMATS=( "ogg" "webm" "mp4" ) |
|
|
|
FLAGS["ogg"]="-c:v libtheora -c:a libvorbis -q:v 6 -q:a 5" |
|
|
|
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["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" |
|
|
|
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 |
|
|
|
for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do |
|
|
|
for format in ${FORMATS}; do |
|
|
|
for format in "${FORMATS[@]}"; do |
|
|
|
t="${f/$SRC/$DST/${format}}" |
|
|
|
t="${f/$SRC/$DST}" |
|
|
|
t="${t%.*}.${f}" |
|
|
|
t="${t%.*}.${format}" |
|
|
|
if test -s "${t}"; then |
|
|
|
if test -s "${t}"; then |
|
|
|
continue; # ignore if file exists and is not empty |
|
|
|
continue; # ignore if file exists and is not empty |
|
|
|
fi |
|
|
|
fi |
|
|
@ -20,7 +20,7 @@ for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type |
|
|
|
rm "$t"; # remove existing empty file |
|
|
|
rm "$t"; # remove existing empty file |
|
|
|
fi |
|
|
|
fi |
|
|
|
test -d "${t%/*}" || mkdir -p "${t%/*}" |
|
|
|
test -d "${t%/*}" || mkdir -p "${t%/*}" |
|
|
|
if ( ! avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t" |
|
|
|
if ( ! avconv -i "$f" ${FLAGS[$format]} -filter:v yadif "$t" \ |
|
|
|
|| ! test -s "${t}") && test -e "$t"; then |
|
|
|
|| ! test -s "${t}") && test -e "$t"; then |
|
|
|
rm "$t"; # remove file if conversion failed |
|
|
|
rm "$t"; # remove file if conversion failed |
|
|
|
fi |
|
|
|
fi |
|
|
|