only one converter for all video formats

This commit is contained in:
Marc Wäckerlin
2015-03-31 13:54:46 +00:00
parent e9a4c2c5ba
commit f46fdff9c9
4 changed files with 29 additions and 56 deletions

29
src/convert-videos.sh Executable file
View File

@@ -0,0 +1,29 @@
#! /bin/bash -ex
SRC=${1:-.}
DST=${2:-/var/tmp/spielfilme}
FORMATS="ogg webm mp4"
declare -A FLAGS
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
for format in ${FORMATS}; do
t="${f/$SRC/$DST/${format}}"
t="${t%.*}.${f}"
if test -s "${t}"; then
continue;
fi
if ( ! test -s "${t}" ) && ( test -e "$t" ); then
rm "$t"
fi
test -d "${t%/*}" || mkdir -p "${t%/*}"
avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t"
if ( ! test -s "${t}" ) && ( test -e "$t" ); then
rm "$t"
fi
done
done