From f46fdff9c99d8c77e59f11eea2143c930a53d50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Tue, 31 Mar 2015 13:54:46 +0000 Subject: [PATCH] only one converter for all video formats --- src/convert-videos.sh | 29 +++++++++++++++++++++++++++++ src/tomp4.sh | 21 --------------------- src/toogg.sh | 17 ----------------- src/towebm.sh | 18 ------------------ 4 files changed, 29 insertions(+), 56 deletions(-) create mode 100755 src/convert-videos.sh delete mode 100755 src/tomp4.sh delete mode 100755 src/toogg.sh delete mode 100755 src/towebm.sh diff --git a/src/convert-videos.sh b/src/convert-videos.sh new file mode 100755 index 0000000..24623ff --- /dev/null +++ b/src/convert-videos.sh @@ -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 diff --git a/src/tomp4.sh b/src/tomp4.sh deleted file mode 100755 index 589c493..0000000 --- a/src/tomp4.sh +++ /dev/null @@ -1,21 +0,0 @@ -#! /bin/bash -ex - -SRC=${1:-.} -DST=${2:-/var/tmp/spielfilme/mp4} - -for f in $(find "$SRC" \( \( -name '.??*' -o -name '*.jpg' \) -prune \) -o -type f -print); do - t="${f/$SRC/$DST}" - t="${t%.*}.mp4" - 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" -vcodec libx264 -deinterlace -acodec libvo_aacenc "$t" - avconv -i "$f" -vcodec libx264 -acodec aac -strict experimental -deinterlace "$t" - if ( ! test -s "${t}" ) && ( test -e "$t" ); then - rm "$t" - fi -done diff --git a/src/toogg.sh b/src/toogg.sh deleted file mode 100755 index 01ebffc..0000000 --- a/src/toogg.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/bash - -SRC=${1:-.} -DST=${2:-/var/tmp/spielfilme/ogg} - -for f in $(find "$SRC" \( -name '*.jpg' -prune \) -o -type f -print); do - t="${f/$SRC/$DST}" - t="${t%.*}.ogg" - if test -s "${t}"; then - continue; - fi - test -d "${t%/*}" || mkdir -p "${t%/*}" - avconv -i "$f" -c:v libtheora -c:a libvorbis -q:v 6 -q:a 5 "$t" - if ( ! test -s "${t}" ) && ( test -e "$t" ); then - rm "$t" - fi -done diff --git a/src/towebm.sh b/src/towebm.sh deleted file mode 100755 index 73d90f6..0000000 --- a/src/towebm.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/bash - -SRC=${1:-.} -DST=${2:-/var/tmp/spielfilme/webm} - -for f in $(find "$SRC" \( -name '*.jpg' -prune \) -o -type f -print); do - t="${f/$SRC/$DST}" - t="${t%.*}.webm" - if test -s "${t}"; then - continue; - fi - test -d "${t%/*}" || mkdir -p "${t%/*}" - #ffmpeg -i "$f" -b 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 "$t" - avconv -i "$f" -vcodec libvpx -acodec libvorbis -f webm -g 30 "$t" - if ( ! test -s "${t}" ) && ( test -e "$t" ); then - rm "$t" - fi -done