Files
HexaCone/tools/make_one_seq.sh
T
2026-11-13 21:48:23 +01:00

78 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e ; set -u
source tools/config.sh
source tools/fonctions.sh
SEQNAME="$1"
LAST="WS/$SEQNAME.last"
if [ ! -r $LAST ]
then
echo 0 > $LAST
fi
NEXT=$(head -1 $LAST)
echo "MakeOneSeq $SEQNAME : $NEXT" >> WS/log
DIMS="-W$Img_Width -H$Img_Height"
NBFR=" Declare=NbFrames=$NBFRAMES "
POVOPT="+q9 +A -v -d ${DIMS} ${NBFR} -WT4"
echo $NBFR "frames."
# echo $POVOPT ; echo ; sleep 2
TMPIMG=/dev/shm/hc-${SEQNAME}-tmp.png
# echo "TMPIMG" ${TMPIMG} | tee -a WS/log # DEBUG !
count=$(( ($RANDOM % 33) + 50 ))
printf "cout : %3d\n" $count | tee -a WS/log
for idx in $(seq 0 $count)
do
frame=$(( $idx + $NEXT ))
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 -blur 7x7 -colors 8 $img
visual_sleep "render fail" 30
continue
fi
set -e
sqn=$(echo ${SEQNAME} | tr [a-z] [A-Z])
txt=$(printf "%03d" ${frame} | tr '01' 'ol')
# echo $frame $img $txt
convert ${TMPIMG} \
-font Courier-Regular \
-pointsize 64 \
-kerning 7 \
-strokewidth 1 \
-fill ${STROKOL} -stroke ${TEXTCOL} \
-gravity south-west \
-annotate +25+5 "$sqn" \
-gravity south-east \
-annotate +25+5 "$txt" \
${img}
fin=$(date +%s)
echo ; sleep 1
printf "%-12s %5d %5d\n" \
${SEQNAME} $frame $(( fin-debut )) | \
tee -a WS/mp4.timing
echo $(( $NEXT + 1)) > $LAST
done
date --utc > WS/$SEQNAME.done
echo
ff_encodage $SEQNAME wip-${SEQNAME}.mp4
echo "build of '$SEQNAME' done" | tee -a WS/log