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

# <h01ger> so, you suggest to encode the 720x576 dv-files to 768x576 and to 384x288?! 
# <hermanr_> Hmm... I'd rather not upsample the video from 720 to 768 pixels wide, as that would be lossier than maintaining the width.
#<h01ger> ic
#<hermanr_> That is, if the container does not have aspect info (Ogg/Theora has, AFAIK), upsampling may be prudent, lest most people will see an image that is slightly squashed.











#
# written by / copyright 2006/2007 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="FOSDEM2007 videoteam"
COPYRIGHT="debconf6 video licence"
# see http://meetings-archive.debian.net/pub/debian-meetings/LICENSE

SOURCE=../rawdv
TARGET=fosdem
export TARGET

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

echo "`date` started encoding" |mail -s "encoding started" videoteam

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

# good theoras
#cd ${SOURCE} && time for i in *.avi ; 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%.avi}.ogg ; done && cd ../$TARGET/ogg_theora/720x576 && rm MD5SUMS.txt ; md5sum * > MD5SUMS.txt ; cd ../../..
echo "`date`" |mail -s "good quality theoras done" videoteam

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

# low quality mpegs
#cd ${SOURCE} && time for i in *.avi ; 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 360x288  ../$TARGET/mpeg/360x288/${i%.avi}.mpeg ; done && cd ../$TARGET/mpeg/360x288 && rm MD5SUMS.txt && md5sum * > MD5SUMS.txt && cd ../../..
echo "`date`" |mail -s "low quality mpegs done" videoteam

# xvids
cd ${SOURCE} && time for i in *.avi ; do time nice -n 19 mencoder "$i" -of avi -ovc xvid -xvidencopts bitrate=3500 -oac mp3lame -srate 48000 -o ../$TARGET/xvid/${i%.avi}_xvid.avi ; done && cd ../$TARGET/xvid && rm MD5SUMS.txt && md5sum * > MD5SUMS.txt && cd ../..
echo "`date`" |mail -s "good quality xvids done" videoteam

echo "`date`" |mail -s "encoding done" videoteam



