#!/bin/bash # Thanks to http://www.linux.com/articles/53702 for inspiration & advice out="." log=$0.log.txt if [[ -d $out ]]; then rm -fr $out; fi if [[ -f $log ]]; then rm -fr $log; fi for d in $(find $out -maxdepth 1 -type d -name "Part*" | sort); do f=${d#./}; echo " -- [$f started @ `date +%I:%M:%S`] --" | tee -a $log; if [[ -f ${f}.mpg ]]; then rm -fr ${f}.mpg; fi mencoder -quiet -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts \ vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=16/9:acodec=ac3:abitrate=192 -ofps 30000/1001 \ -o $out/${f}.mpg $out/$f/*.MPG 2>/dev/null >> $log; echo " -- [$f done @ `date +%I:%M:%S`] --" | tee -a $log; echo "" | tee -a $log; echo " ------------------------------------------------------------------------" >> $log; echo "" >> $log done