refactoring the build system
This commit is contained in:
parent
5b7ad96a29
commit
d89876b633
4
tools/README.md
Normal file
4
tools/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# Tools
|
||||
|
||||
Build system and utilities.
|
||||
|
14
tools/encode.sh
Executable file
14
tools/encode.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e ; set -u
|
||||
|
||||
if [ $# == 1 ]
|
||||
then
|
||||
srcdir=$1
|
||||
else
|
||||
srcdir="essai"
|
||||
fi
|
||||
|
||||
source tools/fonctions.sh
|
||||
|
||||
ff_encodage $srcdir wip.mp4
|
53
tools/fonctions.sh
Normal file
53
tools/fonctions.sh
Normal file
@ -0,0 +1,53 @@
|
||||
|
||||
set -eu
|
||||
|
||||
# --------------------------------------------------------------
|
||||
ralentisseur ()
|
||||
{
|
||||
temps=$1
|
||||
|
||||
load=$(awk '{print int($1)}' < /proc/loadavg)
|
||||
# echo " load is $load" | tee -a WS/log
|
||||
if [ $load -gt 10 ] ; then
|
||||
attente=$(( $temps + ($RANDOM % 90) ))
|
||||
echo "ralentir $0 $SEQNAME $attente" # | tee -a WS/log
|
||||
sleep $attente
|
||||
fi
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
||||
ff_encodage()
|
||||
{
|
||||
SRCDIR="$1"
|
||||
FILMNAME="$2"
|
||||
|
||||
echo "Encoding $SRCDIR to $FILMNAME" | tee -a WS/log
|
||||
ffmpeg -nostdin \
|
||||
-y -r 30 -f image2 -i frames/${SRCDIR}/%05d.png \
|
||||
-metadata artist='--[ tTh ]--' \
|
||||
-metadata title='-- HexaCone --' \
|
||||
-c:v libx264 \
|
||||
-pix_fmt yuv420p \
|
||||
-tune film \
|
||||
$FILMNAME
|
||||
|
||||
# wc -c $FILMNAME | tee -a WS/log
|
||||
}
|
||||
# --------------------------------------------------------------
|
||||
|
||||
mp_encodage()
|
||||
{
|
||||
#
|
||||
# NOT WORKING !
|
||||
#
|
||||
mencoder 'mf://frames/*.png' \
|
||||
-mf \
|
||||
fps=24 \
|
||||
-ovc lavc \
|
||||
-lavcopts vcodec=mpeg4 \
|
||||
-o output.avi
|
||||
}
|
||||
|
||||
# --------------------------------------------------------------
|
||||
# --------------------------------------------------------------
|
111
tools/linkfarmer.sh
Executable file
111
tools/linkfarmer.sh
Executable file
@ -0,0 +1,111 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e ; set -u
|
||||
|
||||
IDX=0
|
||||
SPOOL="frames/Spool"
|
||||
SEQNAME="none"
|
||||
TMP="WS/tmp.png"
|
||||
|
||||
source tools/fonctions.sh
|
||||
|
||||
# -------------------------------------------------------
|
||||
# /!\ this function just copy the
|
||||
# file to the spool dir, so
|
||||
# you can use it for tmp pics.
|
||||
#
|
||||
addfile ()
|
||||
{
|
||||
src="$1"
|
||||
dstname=$(printf "%s/%05d.png" $SPOOL $IDX)
|
||||
# echo "$src -> $dstname"
|
||||
# ln --force --symbolic $src $dstname
|
||||
cp -f $src $dstname
|
||||
IDX=$(( IDX + 1 ))
|
||||
}
|
||||
# -------------------------------------------------------
|
||||
linkfarm ()
|
||||
{
|
||||
SRC="frames/$1"
|
||||
echo "linkfarm $SRC" | tee -a WS/log
|
||||
|
||||
local NBRE=30
|
||||
for foo in $(seq 0 $NBRE)
|
||||
do
|
||||
addfile "$SRC/00000.png"
|
||||
done
|
||||
|
||||
for src in "$SRC"/*
|
||||
do
|
||||
addfile $src
|
||||
done
|
||||
|
||||
for foo in $(seq 0 $NBRE)
|
||||
do
|
||||
addfile "$SRC/00359.png"
|
||||
done
|
||||
sync
|
||||
}
|
||||
# -------------------------------------------------------
|
||||
faire_le_titre ()
|
||||
{
|
||||
echo "faire le titre"
|
||||
|
||||
local NBRE=190
|
||||
for foo in $(seq 0 $NBRE)
|
||||
do
|
||||
Ypos=$(( 500 - ( foo / 2 ) ))
|
||||
convert "WS/negatif.png" \
|
||||
-gravity north \
|
||||
-font Courier-Bold \
|
||||
-pointsize 96 \
|
||||
-fill white \
|
||||
-annotate +0+${Ypos} "HexaCone(s)" \
|
||||
${TMP}
|
||||
# identify ${TMP}
|
||||
addfile ${TMP}
|
||||
done
|
||||
}
|
||||
# -------------------------------------------------------
|
||||
faire_la_fin ()
|
||||
{
|
||||
local NBRE=120
|
||||
for foo in $(seq 0 $NBRE)
|
||||
do
|
||||
Ypos=$(( foo + 100 ))
|
||||
convert "WS/negatif.png" \
|
||||
-gravity north \
|
||||
-font Courier-Bold \
|
||||
-pointsize 48 \
|
||||
-fill white \
|
||||
-strokewidth 2 -stroke gray30 \
|
||||
-annotate +0+${Ypos} \
|
||||
"tTh des Bourtoulots\n2025" \
|
||||
${TMP}
|
||||
# identify ${TMP}
|
||||
addfile ${TMP}
|
||||
done
|
||||
}
|
||||
# -------------------------------------------------------
|
||||
|
||||
rm frames/Spool/*.png
|
||||
|
||||
tools/plot-timing.sh
|
||||
faire_le_titre
|
||||
|
||||
linkfarm hexabenz
|
||||
linkfarm orbite
|
||||
linkfarm topview
|
||||
linkfarm passage
|
||||
linkfarm scene
|
||||
linkfarm essai
|
||||
|
||||
tools/plot-timing.sh
|
||||
faire_la_fin
|
||||
|
||||
ff_encodage Spool full.mp4
|
||||
|
||||
|
||||
|
||||
|
||||
|
56
tools/plot-timing.sh
Executable file
56
tools/plot-timing.sh
Executable file
@ -0,0 +1,56 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ue
|
||||
|
||||
TMPFILE="/dev/shm/plot-timing.tmp"
|
||||
IMAGE="timing.png"
|
||||
|
||||
echo ; figlet "plot timing" ; echo
|
||||
wc WS/mp4.timing | tee -a WS/log
|
||||
|
||||
grep "passage" WS/mp4.timing | awk ' \
|
||||
BEGIN { \
|
||||
nbrames=360; \
|
||||
for (foo=0; foo<nbrames; foo++) { \
|
||||
mini[foo] = 666; \
|
||||
maxi[foo] = -42; \
|
||||
count[foo] = 0; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
{ \
|
||||
accu[$2] += $3; \
|
||||
count[$2]++; \
|
||||
if (mini[$2] > $3) mini[$2] = $3; \
|
||||
if (maxi[$2] < $3) maxi[$2] = $3; \
|
||||
} \
|
||||
\
|
||||
END { \
|
||||
for (foo=0; foo<nbrames; foo++) { \
|
||||
if (count[foo] > 0) { \
|
||||
mean = accu[foo] / count[foo]; \
|
||||
printf "%4d %4f %4d %4d\n", foo, mean, \
|
||||
mini[foo], maxi[foo]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
' > $TMPFILE
|
||||
|
||||
# cat -n $TMPFILE | tail # ; exit
|
||||
|
||||
gnuplot << __EOC__
|
||||
set term png size 1024,768
|
||||
set output "timing.png"
|
||||
set grid
|
||||
set xrange [:360]
|
||||
set yrange [0:]
|
||||
set title "HexaCone : temps de rendu"
|
||||
set xlabel "numéro de la trame"
|
||||
set ylabel "temps en secondes"
|
||||
plot "/dev/shm/plot-timing.tmp" u 1:4 w l t "maximum", \
|
||||
"/dev/shm/plot-timing.tmp" u 1:3 w l t "minimum", \
|
||||
"/dev/shm/plot-timing.tmp" u 1:2 w l t "moyenne",
|
||||
__EOC__
|
||||
|
||||
convert -negate $IMAGE WS/negatif.png
|
||||
|
Loading…
Reference in New Issue
Block a user