Take input from env-vars, render to output directory
This commit is contained in:
parent
d40748c66d
commit
2273e16908
3 changed files with 42 additions and 14 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
output
|
53
generate.sh
53
generate.sh
|
@ -1,24 +1,49 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SOURCEDIR=`pwd`
|
SOURCEDIR=`pwd`
|
||||||
SOURCEFILE="nluug-title-template.svg"
|
PROJECT=$1
|
||||||
PROJDIR=`pwd`/proj1/
|
BASETEMPLATE="nluug-title-template.svg"
|
||||||
|
SOURCEFILE="event.svg"
|
||||||
|
VIDEODIR=${SOURCEDIR}/output
|
||||||
|
PROJDIR=/tmp/nluug-intro-${PROJECT}
|
||||||
|
|
||||||
|
if [ -z "${PROJECT}" ]; then
|
||||||
|
echo "Usage: $0 <project>"
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$EVENTNAME" ]; then
|
||||||
|
echo "Specify EVENTNAME env-var"
|
||||||
|
exit 2;
|
||||||
|
fi
|
||||||
|
if [ -z "$SPEAKERNAME" ]; then
|
||||||
|
echo "Specify SPEAKERNAME env-var"
|
||||||
|
exit 3;
|
||||||
|
fi
|
||||||
|
if [ -z "$TITLE1" -o -z "$TITLE2" -o -z "$TITLE3" ]; then
|
||||||
|
echo "Specify TITLE1/TITLE2/TITLE3 env-vars"
|
||||||
|
exit 4;
|
||||||
|
fi
|
||||||
|
|
||||||
|
# EVENTNAME="NLUUG Najaar 5 November 2024"
|
||||||
# MAXLENGTH="SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER"
|
# MAXLENGTH="SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER"
|
||||||
SPEAKERNAME="Gunes Acar"
|
#SPEAKERNAME="Example Speaker Name"
|
||||||
# MAX="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
# MAX="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
|
||||||
TITLE1="Keynote: From Cookies to"
|
#TITLE1="Keynote: Some example title"
|
||||||
TITLE2="Keyloggers: Understanding Modern"
|
#TITLE2="With 3 lines, or use some whitespace"
|
||||||
TITLE3="Online Tracking Techniques"
|
#TITLE3="If less are needed"
|
||||||
|
|
||||||
CONV="convert -background black -fill black -alpha off"
|
CONV="convert -background black -fill black -alpha off"
|
||||||
FRAMENUM=0
|
FRAMENUM=0
|
||||||
|
|
||||||
# Make project directory
|
# Make project directory
|
||||||
mkdir ${PROJDIR}; cd ${PROJDIR}
|
mkdir -p ${PROJDIR}; cd ${PROJDIR}
|
||||||
|
|
||||||
|
# Customize tempalte to this event from base template
|
||||||
|
cat ${SOURCEDIR}/$BASETEMPLATE | sed -e "s/EVENTNAMEEVENTNAMEEVENTNAMEEVENTNAME/$EVENTNAME/" > ${SOURCEFILE}
|
||||||
|
|
||||||
# Create initial image without title/speaker info
|
# Create initial image without title/speaker info
|
||||||
cat ${SOURCEDIR}/${SOURCEFILE} | sed -e 's/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER//' -e 's/TITLE[123]//' > ${PROJDIR}/frameclear.svg
|
cat ${SOURCEFILE} | sed -e 's/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER//' -e 's/TITLE[123]//' > frameclear.svg
|
||||||
|
|
||||||
# Fade this image in from 100% transparant to 'normal'
|
# Fade this image in from 100% transparant to 'normal'
|
||||||
echo "Generate fade-in-from-black sequence"
|
echo "Generate fade-in-from-black sequence"
|
||||||
|
@ -36,7 +61,7 @@ for i in `seq 0 ${SLEN}`
|
||||||
do
|
do
|
||||||
echo "Generate frame ${FRAMENUM}"
|
echo "Generate frame ${FRAMENUM}"
|
||||||
SN="${SPEAKERNAME::$i}"
|
SN="${SPEAKERNAME::$i}"
|
||||||
cat ${SOURCEDIR}/${SOURCEFILE} | sed -e "s/TITLE[123]//" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SN/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
cat ${SOURCEFILE} | sed -e "s/TITLE[123]//" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SN/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
||||||
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
||||||
((FRAMENUM++))
|
((FRAMENUM++))
|
||||||
done
|
done
|
||||||
|
@ -62,14 +87,14 @@ do
|
||||||
T1="${TITLE1::$i}" # Substring, first i characters
|
T1="${TITLE1::$i}" # Substring, first i characters
|
||||||
T2="${TITLE2::$i}"
|
T2="${TITLE2::$i}"
|
||||||
T3="${TITLE3::$i}"
|
T3="${TITLE3::$i}"
|
||||||
cat ${SOURCEDIR}/${SOURCEFILE} | sed -e "s/TITLE1/$T1/" -e "s/TITLE2/$T2/" -e "s/TITLE3/$T3/" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SN/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
cat ${SOURCEFILE} | sed -e "s/TITLE1/$T1/" -e "s/TITLE2/$T2/" -e "s/TITLE3/$T3/" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SN/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
||||||
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
||||||
((FRAMENUM++))
|
((FRAMENUM++))
|
||||||
done
|
done
|
||||||
|
|
||||||
# Generate final frame, with full speakername + title
|
# Generate final frame, with full speakername + title
|
||||||
echo "Generate completed title"
|
echo "Generate completed title"
|
||||||
cat ${SOURCEDIR}/${SOURCEFILE} | sed -e "s/TITLE1/$TITLE1/" -e "s/TITLE2/$TITLE2/" -e "s/TITLE3/$TITLE3/" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SPEAKERNAME/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
cat ${SOURCEFILE} | sed -e "s/TITLE1/$TITLE1/" -e "s/TITLE2/$TITLE2/" -e "s/TITLE3/$TITLE3/" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SPEAKERNAME/" > ${PROJDIR}/frame-${FRAMENUM}.svg
|
||||||
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp
|
||||||
LASTFRAME=$FRAMENUM
|
LASTFRAME=$FRAMENUM
|
||||||
((FRAMENUM++))
|
((FRAMENUM++))
|
||||||
|
@ -92,5 +117,7 @@ do
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Rendering to video"
|
echo "Rendering to video"
|
||||||
ffmpeg -framerate 30 -i frame-%d.webp -c:v libx264 -r 30 intro-x264.mkv
|
ffmpeg -framerate 30 -i frame-%d.webp -c:v libx264 -r 30 ${VIDEODIR}/${PROJECT}-x264.mkv
|
||||||
ffmpeg -framerate 30 -i frame-%d.webp -c:v vp9 -r 30 intro-vp9.webm
|
ffmpeg -framerate 30 -i frame-%d.webp -c:v vp9 -r 30 ${VIDEODIR}/${PROJECT}-vp9.webm
|
||||||
|
|
||||||
|
rm *.svg frame-*.webp
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
transform="matrix(0.64500845,0,0,0.64500845,576.16803,19.38728)"><tspan
|
transform="matrix(0.64500845,0,0,0.64500845,576.16803,19.38728)"><tspan
|
||||||
x="107.36523"
|
x="107.36523"
|
||||||
y="802.76728"
|
y="802.76728"
|
||||||
id="tspan196">NLUUG Najaar 5 Nov 2024</tspan></text>
|
id="tspan196">EVENTNAMEEVENTNAMEEVENTNAMEEVENTNAME</tspan></text>
|
||||||
<text
|
<text
|
||||||
xml:space="preserve"
|
xml:space="preserve"
|
||||||
id="text281-5"
|
id="text281-5"
|
||||||
|
|
Before Width: | Height: | Size: 95 KiB After Width: | Height: | Size: 95 KiB |
Loading…
Reference in a new issue