From 938f9c592544e8962746729c7075d5248f2d3227 Mon Sep 17 00:00:00 2001 From: Mark Janssen Date: Wed, 6 Nov 2024 18:17:02 +0100 Subject: [PATCH] Initial version --- generate.sh | 96 +++++++++++++++++++++++++++++ nluug-title-template.svg | 126 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 222 insertions(+) create mode 100755 generate.sh create mode 100644 nluug-title-template.svg diff --git a/generate.sh b/generate.sh new file mode 100755 index 0000000..1560817 --- /dev/null +++ b/generate.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +SOURCEDIR=`pwd` +SOURCEFILE="nluug-title-template.svg" +PROJDIR=`pwd`/proj1/ + +# MAXLENGTH="SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER" +SPEAKERNAME="Gunes Acar" +# MAX="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" +TITLE1="Keynote: From Cookies to" +TITLE2="Keyloggers: Understanding Modern" +TITLE3="Online Tracking Techniques" + +CONV="convert -background black -fill black -alpha off" +FRAMENUM=0 + +# Make project directory +mkdir ${PROJDIR}; cd ${PROJDIR} + +# Create initial image without title/speaker info +cat ${SOURCEDIR}/${SOURCEFILE} | sed -e 's/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER//' -e 's/TITLE[123]//' > ${PROJDIR}/frameclear.svg + +# Fade this image in from 100% transparant to 'normal' +echo "Generate fade-in-from-black sequence" +for i in `seq 100 -3 0` +do + echo "Generate frame ${FRAMENUM}" + ${CONV} -colorize ${i}% frameclear.svg frame-${FRAMENUM}.webp + ((FRAMENUM++)) +done + +echo "Add speakername sequence" +SLEN=${#SPEAKERNAME} # Length of name +# Copy a new frame, and fill in the speaker name 1 character at a time +for i in `seq 0 ${SLEN}` +do + echo "Generate frame ${FRAMENUM}" + SN="${SPEAKERNAME::$i}" + cat ${SOURCEDIR}/${SOURCEFILE} | sed -e "s/TITLE[123]//" -e "s/SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER/$SN/" > ${PROJDIR}/frame-${FRAMENUM}.svg + ${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp + ((FRAMENUM++)) +done + +echo "Add title sequence" +# Find longest title +TL1=${#TITLE1} +TL2=${#TITLE2} +TL3=${#TITLE3} +if [ $TL1 > $TL2 ]; then + TLEN=$TL1 +else + TLEN=$TL2 +fi +if [ $TL3 > $TLEN ]; then + TLEN=$TL3 +fi + +# With speakername, not add the title, 1 char (per line) at a time +for i in `seq 0 40` +do + echo "Generate frame ${FRAMENUM}" + T1="${TITLE1::$i}" # Substring, first i characters + T2="${TITLE2::$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 + ${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp + ((FRAMENUM++)) +done + +# Generate final frame, with full speakername + 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 +${CONV} frame-${FRAMENUM}.svg frame-${FRAMENUM}.webp +LASTFRAME=$FRAMENUM +((FRAMENUM++)) + +# Now copy the rendered output of the last frame a few more times so we can read it before the video ends +for i in `seq 0 1 100` +do + echo "Duplicating frame ${FRAMENUM}" + cp frame-${LASTFRAME}.webp frame-${FRAMENUM}.webp + ((FRAMENUM++)) +done + +# Fade this image out over 100 frames back to the normal view +echo "Generate fade-out-sequence" +for i in `seq 0 3 100` +do + echo "Generate frame ${FRAMENUM}" + ${CONV} -colorize ${i}% frame-${LASTFRAME}.svg frame-${FRAMENUM}.webp + ((FRAMENUM++)) +done + +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 vp9 -r 30 intro-vp9.webm diff --git a/nluug-title-template.svg b/nluug-title-template.svg new file mode 100644 index 0000000..01ff1e1 --- /dev/null +++ b/nluug-title-template.svg @@ -0,0 +1,126 @@ + + + + + + + + + + + + + NLUUG Najaar 5 Nov 2024 + SPEAKERSPEAKERSPEAKERSPEAKERSPEAKER +TITLE1 +TITLE2 +TITLE3 + + + + + + + + + + + + + + + + +