2023-02-11 21:03:33 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
SPASS="../Fonderie/singlepass"
|
|
|
|
|
|
|
|
SRCDIR=$HOME"/Essais/PS-eye/frames/"
|
|
|
|
DSTPOL=$HOME"/TMP/"
|
2023-04-09 05:28:07 +02:00
|
|
|
echo "source = " $SRCDIR
|
|
|
|
echo "spool = " $DSTPOL
|
2023-02-11 21:03:33 +01:00
|
|
|
|
|
|
|
LINKFARM=$DSTPOL"LinkFarm"
|
|
|
|
echo "linkfarm = " $LINKFARM
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
# VIDZ="$HOME/BU/vrac/all_effects.mp4"
|
|
|
|
VIDZ="foo.mp4"
|
2023-02-11 21:03:33 +01:00
|
|
|
echo "lolvidz = " $VIDZ
|
|
|
|
|
|
|
|
LINKNUM=0
|
|
|
|
|
|
|
|
# --------------------------------------------
|
|
|
|
|
|
|
|
do_an_effect_pass()
|
|
|
|
{
|
|
|
|
local effect=$1
|
|
|
|
local ddir=$2
|
|
|
|
|
2023-02-13 17:56:08 +01:00
|
|
|
figlet "$effect" ; echo
|
2023-04-09 05:28:07 +02:00
|
|
|
echo " files to ===> " $ddir
|
2023-02-11 21:03:33 +01:00
|
|
|
|
|
|
|
rm -f $ddir/?????.png
|
|
|
|
|
|
|
|
$SPASS -F $effect \
|
|
|
|
-g $SRCDIR/'?????.fimg' \
|
|
|
|
-O $ddir \
|
2023-02-13 17:56:08 +01:00
|
|
|
-r 1
|
|
|
|
|
2023-02-11 21:03:33 +01:00
|
|
|
}
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
# --------------------------------------------
|
|
|
|
insert_blank()
|
|
|
|
{
|
|
|
|
local count=$1
|
|
|
|
|
|
|
|
local imgname="$DSTPOL/blank.fimg"
|
|
|
|
|
|
|
|
if [ ! -r $imgname ] ; then
|
|
|
|
mkfimg -v -t black $imgname 640 480
|
|
|
|
fimg2png -v $imgname $DSTPOL/blank.png
|
|
|
|
echo "blankimage done" | boxes
|
|
|
|
# display $DSTPOL/blank.png &
|
|
|
|
# exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
for foo in $(seq 0 $count)
|
|
|
|
do
|
|
|
|
linkname=$(printf "%s/L%05d.png" $LINKFARM $LINKNUM)
|
|
|
|
ln --force --symbolic $DSTPOL/blank.png $linkname
|
|
|
|
# file $linkname
|
|
|
|
LINKNUM=$(( LINKNUM + 1 ))
|
|
|
|
done
|
|
|
|
}
|
2023-02-11 21:03:33 +01:00
|
|
|
# --------------------------------------------
|
|
|
|
|
|
|
|
make_the_linkfarm_from()
|
|
|
|
{
|
|
|
|
local effname=$1
|
|
|
|
local sdir=$2
|
|
|
|
|
|
|
|
echo "====== Linkfarming from " $sdir \
|
|
|
|
"====== avec" $(ls $sdir | wc -l) "images"
|
|
|
|
|
2023-02-13 17:56:08 +01:00
|
|
|
mogrify \
|
|
|
|
-font Utopia-Bold \
|
2023-04-09 05:28:07 +02:00
|
|
|
-pointsize 64 \
|
2023-02-13 17:56:08 +01:00
|
|
|
-kerning 9 \
|
2023-04-09 05:28:07 +02:00
|
|
|
-fill Gray90 \
|
|
|
|
-stroke Gray10 \
|
|
|
|
-strokewidth 2 \
|
2023-02-13 17:56:08 +01:00
|
|
|
-gravity South-East \
|
2023-04-09 05:28:07 +02:00
|
|
|
-annotate +30+20 $effname \
|
2023-02-13 17:56:08 +01:00
|
|
|
$sdir/*.png
|
|
|
|
|
2023-02-11 21:03:33 +01:00
|
|
|
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
|
2023-04-09 05:28:07 +02:00
|
|
|
echo " linkfarming done"
|
2023-02-11 21:03:33 +01:00
|
|
|
}
|
|
|
|
# --------------------------------------------
|
|
|
|
# traite tous les effets
|
|
|
|
|
|
|
|
do_all_the_effects()
|
|
|
|
{
|
2023-04-09 05:28:07 +02:00
|
|
|
EFFECTS=$( $SPASS -L | sort )
|
|
|
|
|
|
|
|
banner 'FULL RUN'
|
2023-02-11 21:03:33 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
insert_blank 30
|
2023-02-11 21:03:33 +01:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
# --------------------------------------------
|
|
|
|
|
|
|
|
debug_run()
|
|
|
|
{
|
|
|
|
local eff=$1
|
|
|
|
local DDIR=$DSTPOL"/$eff"
|
|
|
|
|
|
|
|
banner 'DEBUG RUN'
|
|
|
|
echo "DDIR = " $DDIR
|
|
|
|
|
|
|
|
do_an_effect_pass $eff $DDIR
|
|
|
|
make_the_linkfarm_from $eff $DDIR
|
|
|
|
}
|
|
|
|
|
2023-02-11 21:03:33 +01:00
|
|
|
# --------------------------------------------
|
|
|
|
# MAIN
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
echo
|
|
|
|
|
|
|
|
rm -v -f $LINKFARM/L*.png ; echo
|
|
|
|
|
|
|
|
insert_blank 30
|
2023-02-11 21:03:33 +01:00
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
# debug_run 'rndblks'
|
2023-02-11 21:03:33 +01:00
|
|
|
do_all_the_effects
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
banner 'encoding'
|
2023-02-11 21:03:33 +01:00
|
|
|
|
|
|
|
ffmpeg -nostdin \
|
2023-04-09 05:28:07 +02:00
|
|
|
-loglevel warning \
|
|
|
|
-y -r 30 -f image2 -i ${LINKFARM}/L%05d.png \
|
2023-02-11 21:03:33 +01:00
|
|
|
-metadata artist='---[ tTh ]---' \
|
|
|
|
-metadata title='---[ All the 'Fonderie' effects ]---' \
|
|
|
|
-preset veryslow \
|
|
|
|
-c:v libx264 -pix_fmt yuv420p \
|
|
|
|
$VIDZ
|
|
|
|
|
2023-04-09 05:28:07 +02:00
|
|
|
echo " encoding of " $VIDZ " . . . . . [done]"
|
|
|
|
|
|
|
|
|