FloatImg/contrib/do_eff_spass.sh
2023-02-13 17:56:08 +01:00

113 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -e
SPASS="../Fonderie/singlepass"
SRCDIR=$HOME"/Essais/PS-eye/frames/"
DSTPOL=$HOME"/TMP/"
echo "source = " $SRCDIR " spool = " $DSTPOL
LINKFARM=$DSTPOL"LinkFarm"
echo "linkfarm = " $LINKFARM
VIDZ="$HOME/BU/vrac/all_effects.mp4"
echo "lolvidz = " $VIDZ
LINKNUM=0
# --------------------------------------------
do_an_effect_pass()
{
local effect=$1
local ddir=$2
figlet "$effect" ; echo
echo " ===> " $ddir
rm -f $ddir/?????.png
$SPASS -F $effect \
-g $SRCDIR/'?????.fimg' \
-O $ddir \
-r 1
}
# --------------------------------------------
make_the_linkfarm_from()
{
local effname=$1
local sdir=$2
echo "====== Linkfarming from " $sdir \
"====== avec" $(ls $sdir | wc -l) "images"
mogrify \
-font Utopia-Bold \
-pointsize 90 \
-kerning 9 \
-fill Gray80 \
-stroke Gray20 \
-strokewidth 3 \
-gravity South-East \
-annotate +45+125 $effname \
$sdir/*.png
for img in $(ls -1 $sdir/?????.png)
do
linkname=$(printf "%s/L%05d.png" $LINKFARM $LINKNUM)
# echo "image = " $img
# echo "link = " $linkname
ln --force --symbolic $img $linkname
LINKNUM=$(( LINKNUM + 1 ))
done
echo "linkfarming done"
}
# --------------------------------------------
# traite tous les effets
do_all_the_effects()
{
EFFECTS=$( $SPASS -L | sort --reverse )
for effect in $EFFECTS
do
DDIR=$DSTPOL"/$effect"
if [ -d $DDIR ] ; then
rm -f $DDIR"/?????.png"
fi
if [ ! -r $DDIR ] ; then
mkdir -v $DDIR
fi
do_an_effect_pass $effect $DDIR
make_the_linkfarm_from $effect $DDIR
done
}
# --------------------------------------------
# MAIN
rm -v -f $LINKFARM/L?????.png
do_all_the_effects
banner encoding
ffmpeg -nostdin \
-y -r 30 -f image2 -i ${LINKFARM}/L%05d.png \
-metadata artist='---[ tTh ]---' \
-metadata title='---[ All the 'Fonderie' effects ]---' \
-preset veryslow \
-c:v libx264 -pix_fmt yuv420p \
$VIDZ