Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Udo committed Dec 5, 2014
1 parent 1d4191c commit 7c2799b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
timelapse-scripts
=================

Bash scripts for making screen shot time lapse movies on OS X
Bash scripts for making screen shot time lapse movies on OS X.

# Screen Capture

The script `capture-screens.sh` grabs the actual screen content. Open it in a text editor to change its settings. By default, it takes a JPG screenshot off the main screen every second and puts it into the folder Downloads/screencaps/.

You can stop the capture process any time by hitting CTRL-c, and resume by just starting the script again. The naming convention of the capture files contain the timestamp at the moment of start, so at the end the movie frames will be in order. Because of this, you can also combine captured frames from different computers for example if you alternated between your laptop and your desktop.

# Preparing for Movie Generation

After recording the time-lapse, it's time to generate a movie out of it. For this, you'll need the `ffmpeg` command-line tool. Most Macs should already have it, but if you don't you can just download it with Homebrew.

The movie generation has two steps: first sorting through all the captured frames, and finally encoding the movie. Start the sorting operation by launching the script `capture-preparemovie.sh`.

This will put a symbolic link to every frame into the folder ~/Downloads/screencaps_temp/.

# Make the Movie

To launch the encode, start the script `capture-makemovie.sh`. You'll see some updates on screen as the movie is being made. If you see any error messages, it's likely you have captured images with different sizes (for example, if they come from different computers) - in that case, put the differing frames away and encode them later into a second movie.

At the end, a new movie file called ~/Downloads/screencaps.mp4 should appear. After a quick check that it came out OK you can delete the source folders `~/Downloads/screencaps/` and `~/Downloads/screencaps_temp/`.

4 changes: 3 additions & 1 deletion capture-makemovie.sh
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
ffmpeg -start_number 1 -r 30 -i ~/Downloads/screencaps_temp/%05d.jpg -vcodec libx264 -vb 20M ~/Downloads/screencaps.mp4
TEMPDIR=~/Downloads/screencaps_temp

ffmpeg -start_number 1 -r 30 -i $TEMPDIR/%05d.jpg -vcodec libx264 -vb 20M ~/Downloads/screencaps.mp4
7 changes: 5 additions & 2 deletions capture-preparemovie.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
mkdir ~/Downloads/screencaps_temp/
x=1; for i in ~/Downloads/screencaps/*jpg; do counter=$(printf %05d $x); ln "$i" ~/Downloads/screencaps_temp/"$counter".jpg; x=$(($x+1)); done
CAPDIR=~/Downloads/screencaps
TEMPDIR=~/Downloads/screencaps_temp

mkdir $TEMPDIR
x=1; for i in $CAPDIR/*jpg; do counter=$(printf %05d $x); ln "$i" "$TEMPDIR/$counter.jpg"; x=$(($x+1)); done
9 changes: 6 additions & 3 deletions capture-screens.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash

mkdir ~/Downloads/screencaps/
cd ~/Downloads/screencaps/
INTERVAL=1
CAPDIR=~/Downloads/screencaps/

mkdir $CAPDIR
cd $CAPDIR

DATE=`date +%Y%m%d-%H%M%S`
COUNTER=1000000000
Expand All @@ -10,5 +13,5 @@ while true; do
let COUNTER=COUNTER+1
screencapture -Cm -t jpg -x "$DATE-$COUNTER.jpg"
echo "saving screenshot to ~/Downloads/screencaps/$DATE-$COUNTER.jpg"
sleep 1
sleep $INTERVAL
done

0 comments on commit 7c2799b

Please sign in to comment.