1#!/bin/sh 2 3if test X_$# = X_0 ; then 4 echo usage: $0 file.x3dv 2>&1 5 echo '# the resulting output files are file.mp4 or file*.tif' 2>&1 6 echo '# attension: removes file*.rib and/or fle*.tif and/or file*.png' 2>&1 7 exit 1 8fi 9if test -f $1 ; then 10 echo > /dev/null 11else 12 echo "file $1 not found" 2>&1 13 exit 1 14fi 15 16`dirname $0`/../bin/dune -files `grep processor /proc/cpuinfo | wc -l` -rib $1 17FILE=`awk -v fn=$1 'BEGIN { 18 for (i = length(fn); i > 0; i--) { 19 if (substr(fn, i, 1) == ".") { 20 fn = substr(fn, 1, i - 1); 21 break 22 } 23 } 24 for (i = length(fn); i > 0; i--) { 25 if (substr(fn, i, 1) == "/") { 26 print substr(fn, i + 1); 27 exit 28 } 29 } 30 print fn; 31}'` 32for j in $FILE*.rib ; do (aqsis -shaders `dirname $0`:/usr/share/aqsis/shaders/light/ $j &); done 33while test "X_`ps -ef | grep aqsis | grep -v grep | grep -v run_dune_and_aqsis_local.sh`" != "X_" ; 34do sleep 1; done 35for j in $FILE*.rib; do rm $j; done 36if test -x "`which mencoder`" ; then 37 # if mencoder is available, create movie and delete the .tif files 38 mencoder -quiet "mf://`ls $FILE*.tif | sort -V | awk '{printf $0 ","}' `" -mf type=tif:fps=24 -ovc x264 -oac lavc -lavcopts acodec=libfaac:abitrate=56 -srate 48000 -af channels=2 -of lavf -ofps 25 -lavfopts format=mp4 -o $FILE.mp4 2>/dev/null > /dev/null && 39 rm $FILE*.tif 40 rm -f divx2pass.log divx2pass.log.mbtree 41elif test -x "`which png2yuv`" ; then 42 for i in *.tif; do convert -auto-gamma -alpha off $i `basename $i tif`png;done 43 png2yuv -I p -f 24 -b 1 -n `ls $FILE*.png | wc -l` -j $FILE%06d.png > $FILE.yuv 44 if test -x "`which vpxenc`" ; then 45 vpxenc --good --cpu-used=`grep processor /proc/cpuinfo | wc -l` --auto-alt-ref=1 --lag-in-frames=16 --end-usage=vbr --passes=2 --threads=2 --target-bitrate=3000 -o $FILE.webm $FILE.yuv && 46 rm $FILE.yuv # $FILE*.tif $FILE*.png 47 else 48 animate -alpha off `ls $FILE*.tif | sort -V | awk '{printf $0 " "}' ` 49 fi 50fi 51 52