#!/bin/sh
# would be much nicer if this would be a Makefile...

#
# written by / copyright 2006 Holger Levsen <debian@layer-acht.org>
# licenced under GPL
#

#
# needs dvgrab, ffmpeg, ffmpeg2theora, mencoder
#

# grab like this:
#
#dvgrab --size 0 --format qt etch+1_aba

AUTHOR="Holger Levsen"
COPYRIGHT="debconf6 video licence"
# see http://meetings-archive.debian.net/pub/debian-meetings/LICENSE

SOURCE=rawdv
TARGET=qa-meeting-badajoz
export TARGET

mkdir -p ${TARGET}/xvid ${TARGET}/mpeg/720x576 ${TARGET}/ogg_theora/720x576 ${TARGET}/ogg_theora/384x288 ${TARGET}/mpeg/384x288


# low quality theoras
cd ${SOURCE} && time for i in *.mov ; do time nice -n 19 ffmpeg2theora --artist "$AUTHOR" --copyright "$COPYRIGHT" --aspect 4:3 -x 384 -y 288 --inputfps 25 -V 200 -H 32000 -a 3 -c 1 $i -o  ../$TARGET/ogg_theora/384x288/${i%.mov}.ogg ; done && cd ../$TARGET/ogg_theora/384x288 && rm MD5SUMS.txt ; md5sum * > MD5SUMS.txt ; cd ../../..

# good theoras
cd ${SOURCE} && time for i in *.mov ; do time nice -n 19 ffmpeg2theora --artist "$AUTHOR" --copyright "$COPYRIGHT" --aspect 4:3 -x 720 -y 576 --inputfps 25 -V 1200 -H 48000 -a 3 -c 2 $i -o  ../$TARGET/ogg_theora/720x576/${i%.mov}.ogg ; done && cd ../$TARGET/ogg_theora/720x576 && rm MD5SUMS.txt ; md5sum * > MD5SUMS.txt ; cd ../../..

# good mpegs
cd ${SOURCE} && time for i in *.mov ; do time nice -n 19 ffmpeg -author "$AUTHOR" -copyright "$COPYRIGHT" -i $i -target pal-dvd -aspect 4:3 -b 1000 ../$TARGET/mpeg/720x576/${i%.mov}.mpeg ; done && cd ../$TARGET/mpeg/720x576 && rm MD5SUMS.txt ; md5sum * > MD5SUMS.txt ; cd ../../..

# low quality mpegs
cd ${SOURCE} && time for i in *.mov ; do time nice -n 19 ffmpeg -author "$AUTHOR" -copyright "$COPYRIGHT" -i $i -vcodec mpeg1video -b 300 -bt 50 -g 96 -ac 1 -ab 64 -ar 32000 -s 384x288  ../$TARGET/mpeg/384x288/${i%.mov}.mpeg ; done && cd ../$TARGET/mpeg/384x288 && rm MD5SUMS.txt && md5sum * > MD5SUMS.txt && cd ../../..

# xvids
cd ${SOURCE} && time for i in *.mov ; do time nice -n 19 mencoder "$i" -of avi -ovc xvid -xvidencopts bitrate=1800 -oac mp3lame -srate 48000 -o ../$TARGET/xvid/${i%.mov}_xvid.avi ; done && cd ../$TARGET/xvid && rm MD5SUMS.txt && md5sum * > MD5SUMS.txt && cd ../..


