HexaCone/mkloop.sh
2025-01-02 01:23:49 +01:00

67 lines
1.2 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.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 25
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)
# echo $frame $img $txt
convert ${TMPIMG} \
-font Courier-Bold \
-pointsize 16 \
-fill turquoise \
-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 1
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"