From c9157e13c3fa4486f3aa6851213480f837dea51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 23 Feb 2016 17:43:10 +0000 Subject: [PATCH] fixed video conversion --- scripts/convert-videos.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/convert-videos.sh b/scripts/convert-videos.sh index e7d1915..69ac6e3 100755 --- a/scripts/convert-videos.sh +++ b/scripts/convert-videos.sh @@ -3,16 +3,16 @@ SRC=${1:-.} DST=${2:-/var/tmp/spielfilme} -FORMATS="ogg webm mp4" declare -A FLAGS +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 - for format in ${FORMATS}; do - t="${f/$SRC/$DST/${format}}" - t="${t%.*}.${f}" + for format in "${FORMATS[@]}"; do + t="${f/$SRC/$DST}" + t="${t%.*}.${format}" if test -s "${t}"; then continue; # ignore if file exists and is not empty fi @@ -20,8 +20,8 @@ for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type rm "$t"; # remove existing empty file fi test -d "${t%/*}" || mkdir -p "${t%/*}" - if ( ! avconv -i "$f" ${FLAGS[$f]} -filter:v yadif "$t" - || ! test -s "${t}") && test -e "$t"; then + if ( ! avconv -i "$f" ${FLAGS[$format]} -filter:v yadif "$t" \ + || ! test -s "${t}") && test -e "$t"; then rm "$t"; # remove file if conversion failed fi done