HexaCone/mkloop.sh
2024-12-31 12:51:12 +01:00

60 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
source fonctions.sh
set -e ; set -u
TYPE="mp4"
SEQNAME="$1"
NBFRAMES=360
case $TYPE in
"gif89a") DIMS="-W640 -H480" ;;
"mp4") DIMS="-W1024 -H768" ;;
esac
echo "Running $0 $TYPE $SEQNAME" >> WS/log
POVOPT="+q9 +a0.02 -d ${DIMS} -WT6"
echo $POVOPT ; echo ; sleep 2
TMPIMG=/dev/shm/${SEQNAME}-tmp.png
for frame in $(seq 0 $((NBFRAMES-1)))
do
figlet -k $frame
img=$(printf "frames/%s/%05d.png" $SEQNAME $frame)
debut=$(date +%s)
set +e
povray ${POVOPT} +K${frame} -i${SEQNAME}.pov -o${TMPIMG}
err=$?
if [ $err != 0 ] ; then
echo "$SEQNAME fail $frame" >> WS/log
sleep 6
continue
fi
set -e
txt=$(printf "%s %03d" ${SEQNAME} $frame)
echo $frame $img $txt
convert ${TMPIMG} \
-font Courier \
-pointsize 14 \
-fill orange \
-gravity south \
-annotate +0+0 "$txt" \
${img}
fin=$(date +%s)
echo
echo $frame $(( fin - debut )) | tee -a WS/${TYPE}.timing
echo
done
echo
case $TYPE in
"gif89a") convert -delay 8 -dither none \
-colors 102 frames/* foo.gif ;;
"mp4") ff_encodage $SEQNAME wip-${SEQNAME}.mp4 ;;
esac