Video record your mac with my BASH script.
This script I created takes snap shots of the system screen at interval seconds giving. For example:
This code will save a snapshot every 5 seconds with a time stamp on the image. Each file is save in a $HOME/sys_monitor that is made with the date it start it was taken. A user can load all the images in a giving folder then put it in I movie and convert it to a movie the the giving time laps.
Code:
#!/bin/bash
############################################################
#System Monitor v1.0 coded by codecaine aka Jerome Scott II#
############################################################
#Error return values
NO_ARGUMENT=1;
FAIL_CREATE_DIRECTORY=2;
INVALID_NUMBER=3;
TIME_STAMP="$1T`date +%s`"; #time stamp for files $1T is the interval seconds for each shot taken appended to it is the timestamp
DATE=`date "+%d-%m-%y"`; #date folder time where files will be sate
SAVE_LOCATION="$HOME/sys_monitor/$DATE"; #location of saved files
FILE_TYPE='.jpg'; #file types
FILENAME="$SAVE_LOCATION/m$TIME_STAMP$FILE_TYPE"; #filename format
#program usage display function
usage()
{
echo 'Usage';
echo " $0 seconds for each snapshot or $0 -k to terminate the program from running";
echo "Example:"
echo " $0 5";
}
#check if input is a number
isNumber()
{
#Check if user just enter a number. If the number is empty they didn't put in a valid number and the function returns 1 else return 0 on success
local number=`echo "$1" | sed -n '/^[0-9]*$/p'`
if [ -z $number ]
then
return 1;
else
return 0;
fi
}
#check for atleast 1 arugment entered
if [ $# -lt 1 ]
then
usage;
exit $NO_ARGUMENT;
fi
#Stop all instances of this program from from running
if [ "$1" = "-k" ]
then
echo "kill"
killall bash
fi
#check for valid input
if ! isNumber $1
then
usage
exit $INVALID_NUMBER;
fi
#check if the directory exist
if [ -d $SAVE_LOCATION ]
then
echo "Monitored files saving: $SAVE_LOCATION";
screencapture -x $SAVE_LOCATION;
else
if mkdir $SAVE_LOCATION
then
echo "Monitored files saving: $SAVE_LOCATION";
else
echo "Failed to directory to to store files";
exit $FAIL_CREATE_DIRECTORY;
fi
fi
while true
do
#sleep for a giving amount time before the next snapshot
sleep $1;
#update time stamp
TIME_STAMP="$1T`date +%s`";
#update filename
FILENAME="$SAVE_LOCATION/$TIME_STAMP$FILE_TYPE";
screencapture -x "$FILENAME";
done