• user warning: Got error 28 from storage engine query: SELECT DISTINCT t.* FROM drupal_term_node r INNER JOIN drupal_term_data t ON r.tid = t.tid INNER JOIN drupal_vocabulary v ON t.vid = v.vid LEFT JOIN drupal_forum_access fa ON t.tid = fa.tid LEFT JOIN drupal_acl acl_fa ON acl_fa.name = t.tid AND acl_fa.module = 'forum_access' LEFT JOIN drupal_acl_user aclu_fa ON aclu_fa.acl_id = acl_fa.acl_id AND aclu_fa.uid = 0 WHERE ((fa.grant_view >= 1 AND fa.rid IN (1)) OR fa.tid IS NULL OR aclu_fa.uid = 0) AND ( r.vid = 71451 )ORDER BY v.weight, t.weight, t.name in /var/www/dikutal.dk/modules/taxonomy/taxonomy.module on line 632.
  • user warning: Got error 28 from storage engine query: SELECT DISTINCT node.nid AS nid, node.title AS node_title, node.language AS node_language, node.type AS node_type, node.vid AS node_vid, node_revisions.teaser AS node_revisions_teaser, node_revisions.format AS node_revisions_format, node_data_field_date.field_date_value AS node_data_field_date_field_date_value FROM drupal_node node LEFT JOIN drupal_content_field_date node_data_field_date ON node.vid = node_data_field_date.vid LEFT JOIN drupal_term_node term_node ON node.vid = term_node.vid AND (term_node.tid = 9 OR term_node.tid = 10 OR term_node.tid = 12 OR term_node.tid = 19 OR term_node.tid = 18 OR term_node.tid = 13 OR term_node.tid = 16 OR term_node.tid = 17 OR term_node.tid = 11 OR term_node.tid = 14 OR term_node.tid = 15) LEFT JOIN drupal_node_revisions node_revisions ON node.vid = node_revisions.vid INNER JOIN drupal_node_access na ON na.nid = node.nid WHERE (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'book_page_access_view') OR (na.gid = 1 AND na.realm = 'forum_access'))) AND ( ((node.status <> 0) AND (node.type in ('event')) AND (term_node.tid IS NULL)) AND (DATE_FORMAT(ADDTIME(node_data_field_date.field_date_value, SEC_TO_TIME(7200)), '%Y-%m-%d') >= '2014-10-22') )ORDER BY node_data_field_date_field_date_value ASC LIMIT 0, 3 in /var/www/dikutal.dk/sites/all/modules/views/includes/view.inc on line 771.

I’m getting ready for my first Ludum Dare game-jam, which I intentionally will refrain from calling a competition, as that would imply that I believe there is a chance of winning, which for me at this point would be missing the point.

Time Flies...

Time Flies…

Anyway, one of the things I noticed is that there is a tradition for making timelapse videos of the 48 hour creation process, and that there is a program called “Chronolapse” for making said videos which works in windows and linux, but apparently not OS X, which I intend to use for the competition. So building on information from this post on the LD website I’ve made a bash script which handles both continuously capturing the screenshots at preset intervals and putting them together in a timelapse video with ffmpeg.

The script as can be seen below is still a little hands on, but I’m not going to put more time into it at this time.
Notice also that adapting this script to work with linux should be as easy as finding a suitable replacement for the OS X screencapture command the script currently uses. Adaptation to windows should also be possible through something like CYGWIN given that a CLI screencapture program exists for that platform.

And to make it all a little more meta, here is a video of me making the script and writing this blog-post:

And without further ado is the script in all its syntax highlighted glory:

#!/usr/bin/env sh

# seconds between image captures
CAPTURE_RATE=30

#number of monitors to capture
NUM_SCREENS=2

capture_loop (){

scrns_string () {
local ti=0
local outp=""

while [ $ti -lt ${NUM_SCREENS} ]
do
outp="${outp} ${1}_m${ti}.png"
(( ti++ ))
done
echo $outp
}

#fast forwards to largest numbered dump file in PWD
i=0

PREVIOUS=`ls *_merged.png`
for fn in $PREVIOUS
do
if [ ! -f "${i}_merged.png" ]
then
echo "${i}_merged.png"
break
fi
(( i++ ))
done

echo "numbering from ${i}"

while true ;
do
echo `date`‘ Capturing screenshot...’
# IMGNAMES="${i}_m1.png ${i}_m2.png"
IMGNAMES=$(scrns_string $i)
# run three commands as one in the background to counter drifting
screencapture -C -x ${IMGNAMES} && \
`convert ${IMGNAMES} +append ${i}_merged.png` && \
`rm ${IMGNAMES}` &
sleep $CAPTURE_RATE
(( i++ ))
done
}

#combine png images in PWD to movie
make_video (){

sequentialize

SEPTS=""
if [ -z "$1"]
then
SEPTS="5.0"
else
SEPTS=$1
fi

echo "setpts=${SEPTS}*PTS"

ffmpeg -start_number 000001 -i seqtmp_%06d.png -vcodec libx264 -r 30 -b:v 5000k \
-filter:v "setpts=${SEPTS}*PTS" timelapse.mp4
# -s 3840x1200

#remove symlinks
rm seqtmp_*.png
}

# make sorted soft links to images in
# sequential continous order
sequentialize (){
c=1
for i in `ls *_merged.png | sort -n`
do
printf -v NN 'seqtmp_%06d.png' "$c"
ln -sf ${i} ${NN}
(( c++ ))
done
}

# if no arguments given,
if [ -z "$1" ]
then
capture_loop
elif [ "$1" == "--sequentialize" -o "$1" == "-S" ]
then
sequentialize
elif [ "$1" == "--video" -o "$1" == "-V" ]
then
echo "making video"
if [ -z "$2" ]
then
make_video
else
make_video $2
fi
else

echo "Unknown argument: $1"
echo "Usage $0 [-combine ouputname.mp4]"
fi

Handlinger