El Blog

Screen Time-lapse On MacOS

10-01-2023


Save these files as .sh and make them executable using the chmod u+x filename.sh then execute each app with ./filename.sh

Make sure to have a ~/screencapture/jpg directory or rename the commands to the respective path.

By default it will take a picture every 15 seconds and stitch it togehter using ffmpeg into a .mov file.

If you need an open source simple time lapse screen recording app here is what I use:

Screen Recorder:


#!/bin/sh
cd ~/screencapture/jpg;
RES_WIDTH=$(/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution);
RES_WIDTH=(${RES_WIDTH:22:4});
RES_WIDTH=$((RES_WIDTH/2));
while :
NOW=$(date +"%y%m%d%H%M%S");
do screencapture -C -t jpg -x ~/screencapture/jpg/$NOW.jpg;
        sleep 15 & pid=$!
        NOW=$(date +"%y%m%d%H%M%S");
        wait $pid
done
                    

Converter:


#!/bin/sh
NOW=$(date +"%y%m%d%H%M%S");
cd ~/screencapture/jpg;
cnt=0
rm -rf .DS_Store;
for file in *
    do
        if [ -f "$file" ] ; then
        ext=${file##*.}
        printf -v pad "%05d" "$cnt"
        mv "$file" "${pad}.${ext}"
        cnt=$(( $cnt + 1 ))
    fi
done;
rm -rf 00000.jpg;
for pic in *.jpg;
    do convert $pic -resize 50% $pic;
done;
ffmpeg -r 24 -i %05d.jpg -b 20000k ~/screencapture/mov/$USER-$NOW.mov;
rm -rf ./*.jpg;                    
                    

this tutorial is really just a way to archive these for me lol