summaryrefslogtreecommitdiff
authorplurSKI <black.gavin@gmail.com>2010-10-24 04:14:38 (GMT)
committer plurSKI <black.gavin@gmail.com>2010-10-24 04:14:38 (GMT)
commite11883ad327a4b2e418701abb64b5c366fcec446 (patch)
tree710e55641f75a9d6e93e729c02e4a2811e499c53
downloadtimelapseVideo-master.zip
timelapseVideo-master.tar.gz
Initial commitmaster
-rw-r--r--timeLapse.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/timeLapse.sh b/timeLapse.sh
new file mode 100644
index 0000000..ee925d3
--- a/dev/null
+++ b/timeLapse.sh
@@ -0,0 +1,28 @@
+if [ "$#" -lt 2 ]
+then
+ echo "Usage $0 DELAY_IN_SECONDS NUM_CAPTURES"
+ exit 1
+fi
+
+rm -rf /tmp/timeLapseData
+mkdir /tmp/timeLapseData
+
+echo "Click Window to capture"
+WINDOW_ID=`xwininfo | grep "Window id" | cut -f 4 -d " "`
+COUNT=0;
+
+while [ $COUNT -lt $2 ]
+do
+ echo "Progress: $COUNT/$2"
+ sleep $1
+ import -silent -window $WINDOW_ID /tmp/timeLapseData/capture$COUNT.jpg
+ COUNT=`expr $COUNT + 1`
+done
+echo "Completed capture, converting to video"
+
+if [ "$#" -gt 2 ]
+then
+ ffmpeg -y -i /tmp/timeLapseData/capture%1d.jpg -i $3 -b 9800000 timeLapse.mpg
+else
+ ffmpeg -y -i /tmp/timeLapseData/capture%1d.jpg -b 9800000 timeLapse.mpg
+fi