Skip to content
Claude Pageau edited this page Jan 7, 2017 · 122 revisions

There are several utilities included with pi-timolo

pi-timolo-install.sh

This bash script automates the install of pi-timolo files and permissions. It will perform a RPI raspbian system apt-get update and upgrade so if these have not been run for a while it may take some time.
For Easy install of PI-TIMOLO onto a raspbian RPI.
From a computer logged into the RPI via ssh(Putty) session use mouse to highlight command below, right click, copy. Then Select ssh(Putty) window then mouse right click, paste. The command should download and execute the install github install.sh script for pi-timolo.

curl -L https://raw.github.com/pageauc/pi-timolo/master/source/install.sh | bash

See Detailed wiki instructions here How to Install or Upgrade pi-timolo

pi-timolo.sh

This is a bash script that launches pi-timolo.py as a background task. It can be run from a ssh session (Note once running the ssh session can be closed and pi-timolo.py will run as a background task until the process is killed or RPI is rebooted.

./pi-timolo.sh start

Alternatively pi-timolo.sh can be setup to automatically run when the RPI is booted up. This is done by using nano editor to add an entry in the /etc/rc.local per the following

sudo nano /etc/rc.local

Use nano editor to add a new entry just before the exit 0 per the following. Then ctrl-x y to save

To run as pi user

#
# By default this script does nothing.
su pi -c "nohup /home/pi/pi-timolo/pi-timolo.sh start >/dev/null 2>&1 &"
exit 0

To stop the background pi-timolo.py program. At a logged in ssh or terminal session

cd ~/pi-timolo
./pi-timolo.sh stop

or to check status

./pi-timolo.sh

See detailed wiki Instruction here How To Run on Boot

webserver.py and webserver.sh

This is a single file stand alone webserver that needs minimal or no setup. This webserver can be used to remotely view images, video, document, Etc. files from other (LAN) network connected computers using a web browse. Directory links to files and subfolders are dynamically created and displayed in a right side listing that can be arranged and sorted via variables. Variables are contained in the script and allow customization of webserver display and configuration settings.
see detailed wiki instructions here How to View Files via webserver

sync.sh

Uses gdrive to push (sync) local files to a folder on the users google drive. This script can also be re purposed to sync files other than pi-timolo images.
See Detailed wiki Instructions here How to Setup gdrive Sync.

convid.sh

This utility will automate conversion of h264 files to mp4 format. It uses the MP4Box utility that is installed as part of gpac (per pi-timolo-install.sh script). Default is to process h264 files in the /home/pi/pi-timolo/motion folder. Edit the convid.sh script variables to suit. You can also choose to rename or delete h264 files after processing by setting the del_h264 boolean variable to true or false per code comments. It is recommended you leave default delete option in order to save space. The mp4 files can be easily viewed using webserver.sh on the RPI and chrome browser (tested) on a local network computer. Other browsers may allow directly viewing mp4 files as well.

To enable pi-timolo video mode edit /home/pi/pi-timolo/config.py and change the following variable(s).

motionVideoOn = True     # if True then video clip is taken rather than image
motionVideoTimer = 10    # Seconds of video recorded if Motion Detected default=10

It is highly recommended that you keep the motionVideoTimer setting a short duration Eg 5 to 20 seconds. This will reduce browser download time and also save disk space. Normally when there motion is detected, more than one video will be generated. Motion detection is disabled while video is being recorded so setting a short duration enables motion detection faster.

To reduce video file sizes you can reduce the video resolution by editing the following config.py settings

imageWidth = 1024          # Full Size Image Width in px  default=1024
imageHeight = 768          # Full Size Image Height in px default=768 

You can configure sync.sh to upload mp4 files. See sync.sh script variables to do this. Note: This will require a reasonably fast internet connection. To optimize you can reduce video resolution and recording time per recommendations above

Note the most recent video will not be processed by convid.sh since it may be in the process of being written. This should not be an issue since usually if there is motion more than one incident will be recorded. When another video is created it will become the most recent and the previous one will be processed.

You can run this script in a crontab

crontab -e

add the following line to the bottom of the crontab file to execute convid.sh once every minute. This can be changed if you wish eg */2 is every two minutes Etc..

To run as pi user

*/1 * * * * su pi -c "/home/pi/pi-timolo/convid.sh >/dev/null"

or to run as root (important new mp4 files will be owned by root)

*/1 * * * * /home/pi/pi-timolo/convid.sh > /dev/null

TIP - To join two compatible videos (must be same resolution and framerate) use command similar to below

MP4Box -cat file1.mp4 -cat file2.mp4 -new outfile.mp4

You will need to write a script to concatenate a series of files

makevideo.sh

This bash script creates a timelapse video from motion or timelapse images. avconv is used to create an mp4 or avi timelapse video from the source jpg files in source folder (default is /home/pi/pi-timolo/timelapse). A temporary working folder is created since avconv requires consecutively numbered filenames. I often cull small images (very black or very white) so there will be gaps in the numbering. The soft links created in the working folder are created with consecutive numbering thus eliminating the need for the source folder files to have consecutive numbering.

Note This script replaces makemovie.sh and makedailymovie.sh.

For Details See GitHub Wiki here How to Create a Timelapse Video
See Github Code here makevideo.sh

myip.sh

Displays active ip addresses of the Raspberry pi wlan and eth (needed if you access webserver.py). Note you can also use the raspbian ifconfig command. Usage from ssh or terminal shell

./myip.sh 
Clone this wiki locally