Linux Desktop Time-lapse Creation Script

Posted by
April 23rd, 2010 3:25 pm

Here is the script I’m using to create a time-lapse video of my desktop, with webcam video superimposed in the corner and an audio track. Works for me in Debian Linux with uvccapture, scrot, and ffmpeg installed. Hopefully this is helpful for others. Note that I had to hard code the location of the script at one point because I am a bash bonehead. You will probably have to change that to match the location on your system.


#!/bin/bash
#
# Timelapse video creator.
#
# Uses the following tools: uvccapture, scrot, ffmpeg.
#
# Start recording with 'timelapse start' (continues until killed),
# compile captured frames in to a video with 'timelapse compile'.

interval=5 # delay between frames (will probably longer due to processing time)

arg=$1

if [ $arg ]; then
if [ $arg = "frame.jpg" ]; then
counter=`cat counter`
counter=`expr $counter + 1`
echo got video for frame $counter
scrot screen.png
echo got screenshot for frame $counter
composite -gravity southwest frame.jpg screen.png composite.png
convert -quality 100 -resize 800x composite.png `printf "%04d" $counter`.jpg
echo processed frame $counter
echo $counter > counter
elif [ $arg = "compile" ]; then
ffmpeg -shortest -qscale 3 -ab 192k -r 10 -i %04d.jpg -i music.mp3 video.mp4
elif [ $arg = "start" ]; then
uvccapture -oframe.jpg -x320 -y240 -q100 -c/home/win/scripts/timelapse -t$interval
fi
else
echo "timelapse "
fi

Tags: , ,


One Response to “Linux Desktop Time-lapse Creation Script”

  1. RCL says:

    Thank you SO MUCH! :)

    This was exactly what I was looking for. And it worked like a charm!

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]