only one converter for all video formats

master
Marc Wäckerlin 10 years ago
parent e9a4c2c5ba
commit f46fdff9c9
  1. 29
      src/convert-videos.sh
  2. 21
      src/tomp4.sh
  3. 17
      src/toogg.sh
  4. 18
      src/towebm.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

@ -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

@ -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

@ -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
Loading…
Cancel
Save