Fix log.sh, stipple.sh and seq.sh

This commit is contained in:
Matt McWilliams 2021-12-08 17:27:00 -05:00
parent 55a7d83854
commit 015e2fe226
3 changed files with 17 additions and 28 deletions

8
log.sh
View File

@ -21,12 +21,6 @@ xmax=$(echo "$bboxclean" | awk -F', ' '{print $2}')
ymin=$(echo "$bboxclean" | awk -F', ' '{print $3}') ymin=$(echo "$bboxclean" | awk -F', ' '{print $3}')
ymax=$(echo "$bboxclean" | awk -F', ' '{print $4}') ymax=$(echo "$bboxclean" | awk -F', ' '{print $4}')
if [[ "${pen}" != "" ]]; then
pen="'${pen}'"
else
pen=null
fi
query="INSERT OR IGNORE INTO svg (id, file, drawn, moved, starttime, endtime, pen, hash, paths, total, ratio, xmin, xmax, ymin, ymax) VALUES (\ query="INSERT OR IGNORE INTO svg (id, file, drawn, moved, starttime, endtime, pen, hash, paths, total, ratio, xmin, xmax, ymin, ymax) VALUES (\
'$id', \ '$id', \
'$file',\ '$file',\
@ -34,7 +28,7 @@ query="INSERT OR IGNORE INTO svg (id, file, drawn, moved, starttime, endtime, pe
$moved,\ $moved,\
$starttime,\ $starttime,\
$endtime,\ $endtime,\
$pen,\ '$pen',\
'$hash',\ '$hash',\
$paths,\ $paths,\
$total,\ $total,\

4
seq.sh
View File

@ -7,7 +7,7 @@
# #
########################### ###########################
MULTIPLE=2 MULTIPLE=3
FPS=24 FPS=24
RATE=`echo "scale=0;${FPS}/${MULTIPLE}" | bc` RATE=`echo "scale=0;${FPS}/${MULTIPLE}" | bc`
TIMESTR="" TIMESTR=""
@ -39,7 +39,7 @@ fi
mkdir -p "${OUTPUT}" mkdir -p "${OUTPUT}"
ffmpeg -y -re -i "${INPUT}" \ ffmpeg -y -re -r ${FPS} -i "${INPUT}" \
${TIMESTR} \ ${TIMESTR} \
-f image2 \ -f image2 \
-r ${RATE} \ -r ${RATE} \

View File

@ -15,7 +15,7 @@ fi
INPUT=`realpath "${1}"` INPUT=`realpath "${1}"`
OUTPUT=`realpath "${2}"` OUTPUT=`realpath "${2}"`
INVERT="${3}" CONFIG="${3}"
SINGLE="${4}" SINGLE="${4}"
if [ ! -d "${INPUT}" ]; then if [ ! -d "${INPUT}" ]; then
@ -25,7 +25,10 @@ fi
mkdir -p "${OUTPUT}" mkdir -p "${OUTPUT}"
FRAMERATE=12 MULTIPLE=3
FPS=24
RATE=`echo "scale=0;${FPS}/${MULTIPLE}" | bc`
WIDTH=404 WIDTH=404
HEIGHT=374 HEIGHT=374
DOTSIZE=2 DOTSIZE=2
@ -36,8 +39,9 @@ LINE=1.5
FILL=true FILL=true
MODE="stipple" #stipple/tsp MODE="stipple" #stipple/tsp
if [[ "${INVERT}" == "" ]]; then if [[ "${CONFIG}" == "" ]]; then
INVERT="false" echo "Please provide a config file"
exit 1
fi fi
IMAGES="" IMAGES=""
@ -52,26 +56,16 @@ stipple () {
bash white.sh "${png}" "${tmp}" bash white.sh "${png}" "${tmp}"
source "${CONFIG}"
cd ~/src/stipple_gen/ cd ~/src/stipple_gen/
bash stipple_gen.sh \ bash stipple_gen.sh \
--display "false" \
--inputImage "${tmp}" \ --inputImage "${tmp}" \
--outputImage "${OUTPUT}/${name}_rendered.png" \ --outputImage "${OUTPUT}/${name}_rendered.png" \
--outputSVG "${OUTPUT}/${name}.svg" \ --outputSVG "${OUTPUT}/${name}.svg" \
--canvasWidth $WIDTH \ --config "${CONFIG}"
--canvasHeight $HEIGHT \
--dotSizeFactor $DOTSIZE \
--windowWidth $WIDTH \
--windowHeight $HEIGHT \
--maxGenerations $MAXGENERATIONS \
--minDotSize $MINDOTSIZE \
--line $LINE \
--fill $FILL \
--maxParticles $MAXPARTICLES \
--mode $MODE \
--invert $INVERT
if [[ "${INVERT}" != "false" ]]; then if [[ "${invert}" == "true" ]]; then
convert "${OUTPUT}/${name}_rendered.png" -channel RGB -negate "${OUTPUT}/${name}_rendered.png" convert "${OUTPUT}/${name}_rendered.png" -channel RGB -negate "${OUTPUT}/${name}_rendered.png"
fi fi
@ -113,6 +107,7 @@ if [[ "${IMAGES}" == "" ]]; then
VIDEO="${OUTPUT}/${part}.mov" VIDEO="${OUTPUT}/${part}.mov"
fi fi
ffmpeg -y -r ${FRAMERATE} -f image2 -i "${IMAGES}" \ ffmpeg -y -r ${RATE} -f image2 -i "${IMAGES}" \
-r ${FPS} \
-c:v prores_ks -profile:v 3 \ -c:v prores_ks -profile:v 3 \
"${VIDEO}" "${VIDEO}"