HexaCone/mkloop.sh
2025-01-12 02:33:39 +01:00

66 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e ; set -u
source tools/fonctions.sh
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.01 -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 ; sleep 1
# ralentisseur 20 ; echo "go"
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
mogrify -colorspace gray $img
sleep 6
continue
fi
set -e
txt=$(printf "%s %03d" ${SEQNAME} $frame | tr '0' 'o')
# echo $frame $img $txt
convert ${TMPIMG} \
-font Courier-Bold \
-pointsize 18 \
-fill Gray80 \
-gravity south \
-annotate +0+5 "$txt" \
${img}
fin=$(date +%s)
echo ; sleep 1
echo ${SEQNAME} $frame $(( fin - debut )) | \
tee -a WS/mp4.timing
echo ; sleep 3
done
echo
case $TYPE in
"gif89a") convert -delay 8 -dither none \
-colors 102 frames/* foo.gif ;;
"mp4") ff_encodage $SEQNAME wip-${SEQNAME}.mp4 ;;
esac
echo "+------- build of $SEQNAME done"