Giter Club home page Giter Club logo

pageauc / pi-timolo Goto Github PK

View Code? Open in Web Editor NEW
546.0 54.0 102.0 24.44 MB

Raspberry PI-TIMOLO ( PI-TImelapse, MOtion, LOwLight ) uses RPI picamera and OpenCV for Remote Headless Security Monitoring using Motion Tracking, Rclone Auto Sync files with remote storage services. Auto Twilight Transitions and Low Light Camera Settings. Panoramic images using PanTiltHat and More. This project is featured on GitHub Awesome software.

License: MIT License

Python 73.40% Shell 26.60%
opencv pi-camera python lowlight timelapse pi-timolo video ssh curl webserver

pi-timolo's Introduction

PI-TIMOLO Mentioned in Awesome <INSERT LIST NAME>

Raspberry (Pi)camera, (Ti)melapse, (Mo)tion, (Lo)wlight

IMPORTANT: Raspbian Stretch and pi-timolo.py ver 11.11 and earlier has long exposure low light camera freezing issue due to kernel panic that requires a reboot to gain control of camera back per waveform80/picamera#528 pi-timolo.py ver 11.12 has a fix to resolve issue but requires the latest Raspbian firmware. If you encounter camera freeze with latest Stretch image then you will need to run sudo rpi-update to update Stretch to latest firmware. Normal backup precautions are advised before doing the firmware update. See wiki Note: Raspbian Jessie works fine and does Not encounter freezing issue with long exposure low light operation.

  • Release 9.x New Features have been Added. See Wiki Details below
    plugins Setup and Operation
    Rclone Setup and Media Sync (Replaces gdrive)
    watch-app.sh Remote Configuration Management
    python3 Support Details
  • Release 10.x Added Sched Start to Motion Track, Timelapse and VideoRepeat. See Wiki Details below
    How To Schedule Motion, Timelapse or VideoRepeat
    This release requires config.py be updated by the user with config.py.new since new variables have been added.
  • Release 11.12 Added adhoc fix for Debian Stretch kernel panic and camera freeze issue when running under very low light conditions. Note a sudo rpi-update may be required to update firmware if freezing still occurs under pi-timolo.py ver 11.12 or greater
  • Release 11.55 Added config.py setting nightTwilightModeOn True is the normal twilight mode for outside conditions. False is used for indoors conditions where there is no twilight. This setting will avoid overexposure when lights or sudden lighting changes are encountered. If you have previously experienced overexposure when camera is indoors then this setting should help.
  • Release 12.0 Added pantilthat panoramic image stitching Feature with support for Pimoroni and Waveshare pantilthat (and compatilble) hardware. This release also renames all the config.py variable Constants to snake_case and does some code cleanup. You need to update to the new config.py. Built in instructions will prompt you if needed. Please raise github issue if there are problems. See config.py comments and revised wiki for details.

Requirements

Requires a Raspberry Pi computer and a RPI camera module installed. Make sure hardware is tested and works. Most RPI models will work OK. A quad core RPI will greatly improve performance due to threading. A recent version of Raspbian operating system is Recommended.

Quick Install or Upgrade

IMPORTANT - It is suggested you do a Raspbian sudo apt-get update and sudo apt-get upgrade before curl install, since it is No longer performed by the pi-timolo-install.sh script

Step 1 With mouse left button highlight curl command in code box below. Right click mouse in highlighted area and Copy.
Step 2 On RPI putty SSH or terminal session right click, select paste then Enter to download and run script.

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

The command above will download and Run the GitHub pi-timolo-install.sh script. An upgrade will not overwrite configuration files.

  • NOTICE gdrive is no longer installed with pi-timolo-install.sh, I have been testing rclone and it is Now the Default. Some rclone- samples are included. Make a copy of one, rename and edit for your own needs. See Wiki - How to Setup Rclone. Note: If a /usr/local/bin/gdrive File Exists, It Will Remain. Older files are still available on this GitHub Repo.

Test Install

To Test Run default config.py - motion track(HD image) plus timelapse(5 min interval).

cd ~/pi-timolo
./pi-timolo.py

For More Details see Basic Trouble Shooting or pi-timolo Wiki

Description

PI-TIMOLO is primarily designed for headless operation and includes rclone that can securely synchronize specified media folders and files with a users remote storage service of choice. This works well for remote security and monitoring cameras. Camera config.py and conf settings can be easily administered remotely from a designated sync directory using watch-app.sh script using a crontab entry to periodically check for updates between the pi-timolo camera and a users remote storage rclone service name.

pi-timolo is python 2/3 compatible and can take timelapse and/or motion tracking images/videos, separately or together. Will take long exposure Night (lowlight) images for Time Lapse and/or Motion. Has relatively smooth twilight transitions based on a threshold light setting, so a real time clock is not required. Customization settings are saved in a config.py and conf files and optional special purpose plugin config files. Optional plugin feature allows overlaying config.py settings with custom settings for specific tasks.

Includes makevideo.sh to create timelapse or motion lapse videos from images, convid.sh to convert/combine h264 to mp4 format, a simple minumum or no setup web server to view images or videos and menubox.sh to admin settings and stop start pi-timolo and webserver as background tasks.

For more Details see Github Wiki

Minimal Upgrade

If you are just interested in a minimal upgrade (must have pi-timolo previously installed) from a logged in ssh or terminal session execute the following commands.

cd ~/pi-timolo
sudo apt-get install python-opencv
cp config.py config.py.old
cp pi-timolo.py pi-timolo.py.old
wget -O config.py https://raw.github.com/pageauc/pi-timolo/master/source/config.py
wget -O pi-timolo.py https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo.py    

To implement webserver3.py (Buster or Later) perform the following

cp webserver.py webserver2.py
cp webserver3.py webserver.py

Edit config.py to transfer any customized settings from config.py.old

Manual Install or Upgrade

From logged in RPI SSH session or console terminal perform the following. You can review the pi-timolo-install.sh script code before executing.

cd ~
wget https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo-install.sh
more pi-timolo-install.sh    # Review code if required
chmod +x pi-timolo-install.sh
./pi-timolo-install.sh

Menubox

pi-timolo has a whiptail administration menu system. The menu's allow start/stop of pi-timolo.py and/or webserver.py as background tasks, as well as editing configuration files, making timelapse videos from jpg images, converting or joining mp4 files Etc.

To run menubox.sh from ssh console or terminal session execute commands below.

cd ~/pi-timolo
./menubox.sh

menubox main menu

Webserver

I have also written a standalone LAN based webserver.py to allow easy access to pi-timolo image and video files on the Raspberry from another LAN computer web browser. There is no setup required but the display settings can be customized via variables in the config.py file or via menubox admin menuing.
NOTE: webserver.py is normally run in background using menubox.sh, webserver.sh or from /etc/rc.local
To Test Run from ssh console or terminal session.

cd ~/pi-timolo
./webserver.py

webserver browser screen shot

shutdown.py

This will safely halt the raspberry pi when a momentary switch is held for a specified number of seconds for details see wiki How to Use shutdown.py

Reference Links

Detailed pi-timolo Wiki
my pi-timolo and other YouTube Videos playlist
MagPi Object Recognition using pi-timolo
makezine night vision project using pi-timolo
hackster facial recognition using pi-timolo
Neverending project timelapse using pi-timolo
hedgehog camera using pi-timolo and step by step
Museum Insect activity monitoring using pi-timolo
Brett Beeson timelapse cloud project using pi-timolo
Bird and Squirrel Detector

Good Luck Claude Pageau

pi-timolo's People

Contributors

alekiv avatar alyetama avatar kovacsrobi77 avatar martinbarnard avatar pageauc avatar phynerd avatar yppo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pi-timolo's Issues

Love it, but spewing motion images with no motion

Thanks for putting this together. I love it, and have it running as a service. The only problem is that it thinks there is motion when there is no perceptible change from frame to frame, and it's filling up Google Drive. On a B+.

Could you use MPEG motion vectors instead of checking if pixels are changing?

My settings are thus:

# User Configuration variable settings for pitimolo
# Purpose - Motion Detection Security Cam
# Created - 13-Dec-2014
# Done by - Claude Pageau

configTitle = "Typical Local Security Cam Motion Detection Camera with 1080 images"
configName = "demo-motion-1080-num.py"

# These settings should both be False if this script is run as a background /etc/init.d daemon
logDataToFile = False  # logs diagnostic data to a file for review  default=False
verbose = False

# print a test image
imageTestPrint = False     # default=False Set to True to print one image and exit (useful for aligning camera)

# Image Settings
imageNamePrefix = 'front-' # Prefix for all image file names. Eg front-
imageWidth = 1920          # Full Size Image Width in px  default=1980
imageHeight = 1080         # Full Size Image Height in px default=1080
imageVFlip = False         # Flip image Vertically    default=False
imageHFlip = False         # Flip image Horizontally  default=False
imagePreview = False       # Preview image on connected RPI Monitor default=False
noNightShots = False       # Don't Take images at Night default=False
noDayShots = False         # Don't Take images during day time default=False  

# Low Light Night Settings
nightMaxShut = 5.5         # default=5 sec Highest cam shut exposure time. IMPORTANT
 6 sec works sometimes but occasionally locks RPI and HARD reboot required to clear
nightMinShut = .10         # default=.10 sec Lowest camera shut exposure time for transition from day to night (or visa versa)
nightMaxISO = 800          # default=800  Max cam ISO night setting
nightMinISO = 100          # lowest ISO camera setting for transition from day to night (or visa versa)  
nightSleepSec = 10         # default=10 Sec - Time period to allow camera to calculate low light AWB   
nightDayTimer = 2 * 60     # Check stream changes to determine if entering twilight zones
sunsetThreshold = 90       # If in Day and pixAverage below this then time to ram to switch to low light mode and ramp settings
sunriseThreshold = 220     # If in Night and pixAverage below this then time to ramp low light settings

# Settings for Displaying Date/Time Stamp Directly on Images
showDateOnImage = True     # Set to False for No display of date/time on image default= True
showTextBottom = True      # Location of image Text True=Bottom False=Top
showTextWhite = False      # Colour of image Text True=White False=Black
showTextWhiteNight= True   # Change night text to white.  Might help if night needs white instead of black during day or visa versa

# Motion Settings
motionOn = True            # True = motion capture is turned on.  False= No motion detection
motionPrefix = "mo-"       # Prefix Motion Detection images
motionDir = "motion"       # Storage Folder for Motion Detect Images
threshold = 10             # How much a pixel has to change to be counted default=10 (1-200)
sensitivity = 900          # Number of changed pixels to trigger motion default=300
motionVideoOn = False      # If set to True then video clip is taken rather than image
motionVideoTimer = 30      # Number of seconds of video clip to take if Motion Detected
motionForce = 60 * 60      # One Hour Force image if no Motion Detected.  default=60*60
motionNumOn = True         # True=On (filenames Sequenced by Number) otherwise date/time used for filename
motionNumStart = 1000      # Start motion number sequence
motionNumMax  = 500        # Max number of motion images desired. 0=Continuous    default=0
motionNumRecycle = True    # After numberMax reached restart at numberStart instead of exiting default=True
motionMaxDots = 50         # Number of motion dots before starting new line
createLockFile = True     # default=False if True then sync.sh will call grive to sync files to your web google drive if .sync file exists
                           # Lock File is used to indicate motion images are added so sync.sh can sync in background via sudo crontab -e 

# TimeLapse Settings
timelapseOn = False        # Turns timelapse True=On  False=Off
timelapseTimer = 5 * 60    # Seconds between timelapse images
timelapseDir = "timelapse" # Storage Folder for Time Lapse Images
timelapsePrefix = "tl-"    # Prefix timelapse images with this prefix
timelapseExit = 0 * 60     # Will Quit program after specified seconds 0=Continuous  Default=0
timelapseNumOn = True      # True=On (filenames Sequenced by Number) otherwise date/time used for filename
timelapseNumStart = 1000   # Start of timelapse number sequence 
timelapseNumMax = 1000     # Max number of timelapse images desired. 0=Continuous  default=0
timelapseNumRecycle = True # After numberMax reached restart at numberStart instead of exiting default=True   

# ---------------------------------------------- End of User Variables -----------------------------------------------------

Takes 1 motion image then stops

Hi Claude - thank you for all your hard work on this project, it looks great, but I have run into an issue and am not sure what I am doing wrong, hopefully you can point me in the right direction. I am using a model B with a clean install of Raspbian Jessie Lite 2015-11-21. I have updated/upgraded and rpi-updates as well as several reboots. I am using the official Raspberry Pi camera and raspistill works as well as the test image from pi-timolo. I have it configured for motion detection, but when I start it either manually or from init.d it detects motion and takes the first picture then stops. When I check the status it says "failed" and the red led on the camera has gone out. I have tried turning on logging, but it just shows that it took the first picture. It is a 16GB SD class 10 card with 97% free space.

Thanks in advance for any suggestions you might be able to offer.

Corey

New makevideo.sh (replaces makemovie.sh and makedailymovie.sh)

I have written a new makevideo.sh script that now replaces the makemovie.sh and makedailymovie.sh scripts. I will leave the old files on the github repo for a while but local versions will be deleted as part of pi-timolo-install.sh. To upgrade see easy install instructions here https://github.com/pageauc/pi-timolo

The new makevideo.sh script now handles moving encoded timelapse video to a remote share via a mount point. An error message will indicate if there is no share mounted on the folder. There is also a remove source files option. This should be used with caution per code comments.
For additional info see the github wiki
here https://github.com/pageauc/pi-timolo/wiki/How-to-Make-a-Timelapse-Video-from-Images
code here https://github.com/pageauc/pi-timolo/blob/master/source/makevideo.sh

pi-timolo.py release 6.60 20-May-2017 Now very Happy with twilight Transitions

For quite some time I have been struggling with finding a good algorithm for smooth day to night transitions. The Gaussian hyperbola method was not the right curve. The new one is a modified hyperbola that allows for brightness adjustments. Release 6.60 is now very good with very small transition light changes. The nightDarkAdjust works opposite to the previous release in that lower values are are brighter. Currently I have found nightDarkAdjust = 4.7 works well with the camera pointing towards sunrise. My inside camera also works well and will go down to very dark conditions before there is not enough light and the image is essentially black. I am thinking of putting in an option to turn off taking images if pixAve is very low. Anyway give it a try and let me know your comments.

Note - Depending on your previous version, this release will require the updated config.py file. You can perform a Minimal upgrade if you have a recent installation.

cd ~/pi-timolo
cp config.py config.py.old
wget -O config.py https://raw.github.com/pageauc/pi-timolo/master/source/config.py
wget -O pi-timolo.py https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo.py  

Edit the new config.py to transfer any previous customized settings from config.py.old

Claude ....

Image Rotation

Hi Claude- This is what I have been looking for however the case and camera mounting I have requires the image to be rotated 270 degrees is there a way to do this?

Stream overflow trying to get higher resolution images

First: Great software!
I am trying to get higher resolutions than what are the actual defaults config.py (1024 x 768). I'm using that new raspberry pi camera (V2.1).
I'm getting the following errors:

++++++++++++++++++++++++++++++++++
pi-timolo.py - Exiting Program
+++++++++++++++++++++++++++++++++++

Traceback (most recent call last):
File "pi-timolo.py", line 689, in
Main()
File "pi-timolo.py", line 603, in Main
data1 = getStreamImage(False)
File "pi-timolo.py", line 458, in getStreamImage
camera.capture(stream, format='rgb')
File "/usr/lib/python2.7/dist-packages/picamera/camera.py", line 1577, in capture
encoder.close()
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 893, in close
self.stop()
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 881, in stop
self._close_output()
File "/usr/lib/python2.7/dist-packages/picamera/encoders.py", line 795, in _close_output
output.flush()
File "/usr/lib/python2.7/dist-packages/picamera/array.py", line 285, in flush
self.array = bytes_to_rgb(self.getvalue(), self.size or self.camera.resolution)
File "/usr/lib/python2.7/dist-packages/picamera/array.py", line 174, in bytes_to_rgb
'Incorrect buffer length for resolution %dx%d' % (width, height))
picamera.exc.PiCameraValueError: Incorrect buffer length for resolution 100x75

Are there other parameters I should change to make this work?
Thanks!

convid.sh -- join does not delete mp4

hi,

i used convid.sh to join my daily recordings. these are in .mp4 format since i set pi-timolo in your new version to immediately convert all h264 recordings into mp4.

as i would like to join them into one file, i would also like to cleanup/delete the single-files afterwares.
but convid.sh does not have this option.

if you are considering one-script for all movie-operations, you may want to consider deletion after
join ๐Ÿ˜ต ๐Ÿ˜

Crontab example in the wiki may not be correct.

Crontab did not work for me following the example in the wiki.
After some searching around online I tried this and it worked.

*/5 * * * * cd /home/pi/pi-timolo && /home/pi/pi-timolo/sync.sh

I suggest that we check and correct the example if necessary.

Settings in the config.py

This is less of an issue than a clarification. I noticed several values in the config.py were different than their "default" value according to the comments. Like resolution is set to 1280x720, but according to the comments, default is 1920x1080. There was also the shuttertime(?) that should be no more than 5 according to the comments, but was set to 5.8 by default.

But my main question would be about the timer for the timelapse setting, which is by default set to 5_60, which i assume means 5 x 60 sec = 5 minutes. What if i wanted it at 30 sec? Would that be 0.5_60 or 1*30? Maybe both would work? I dunno, but the comments could very well give an example.

If i may be very picky, the installation guide could use a little tidy-up, especially the 'Setup init.d to run pi-timolo on boot' part was confusing to me. I should probably add that English is my 2nd language, and Linux is pretty new to me. I don't wan't to sound like a brat, so i hope you read this as constructive criticism and not whining. And thanks for these great scripts, i'm about to start a 24hr timelapse of my view :)

EDIT! Bonus question: I've set pi-timolo to run on boot. How do i stop it temporarily, say if i wanted to convert a group of pictures into a timelapse video?

Shows an error in terminal

Hi Claude... First of all, I want to thank you for development this program, it is helping me a lot. I was working with this program but suddenly it stopped working. I wish that you could help me with this error, i don't know what happens.
2015-01-17-224447_657x476_scrot

Webserver issue

Hi,

The webserver.py doesn't work with Safari on mac or on an iPad though works fine on firefox on Mac.

On Safari on mac and on iPad, I get:


192.168.0.2 - - [26/Jun/2017 13:03:13] "GET / HTTP/1.1" 200 -
192.168.0.2 - - [26/Jun/2017 13:03:17] "GET /20170626121316.mp4 HTTP/1.1" 200 -

Exception happened during processing of request from ('192.168.0.2', 55298)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 657, in init
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 716, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe

NameError: global name 'motionCamSleep' is not defined

Hi,

I'm new to this, but when I tried to start the application after install, it seems to fail due to a variable not being set. Did I do something wrong or is there an issue with the current version?

+++++++++++++++++++++++++++++++++++
pi-timolo.py - Exiting Program
+++++++++++++++++++++++++++++++++++

Traceback (most recent call last):
File "./pi-timolo/pi-timolo.py", line 751, in
Main()
File "./pi-timolo/pi-timolo.py", line 652, in Main
displayInfo(moCnt, tlCnt)
File "./pi-timolo/pi-timolo.py", line 182, in displayInfo
print(" motionPath=%s motionCamSleep=%.2f sec" % (motionPath, motionCamSleep))
NameError: global name 'motionCamSleep' is not defined

cleanup of all scripts into one: makemovie/makevideo/makedailymovie

my usecase is a little surveillance cam on the raspberry.
and i want to keep a simple and clear archive of daily-happenings.

  1. therefore i use the scripts to create a daily movie of the daily motion-recordings
  2. a script for making a movie of the daily-timelapse.jpgs
  3. an let the scripts clean up the recordings-folder (deletion/archive in daily folder would be nice).

now as there are three scripts for that in the source, it could get confusing between functions and options between all three scripts. my suggestion would be, to make one clear script with options and a single config-file.

what do you think? ๐Ÿ˜‡

Dependency on pyexiv2

There seems to be a dependency on pyexiv2 which no longer has a pip install option?

sudo pip install pyexiv2
Downloading/unpacking pyexiv2
Could not find any downloads that satisfy the requirement pyexiv2
Cleaning up...
No distributions at all found for pyexiv2

or am I missing something in the setup.
raspberry pi zero: raspbian 8 jessie

convert h264 to mp4 right after recording.

hi,
as i can browse only mp4-files without any hasse in chrome, i would be pleased to save all motion-recordings directly as mp4. as this seems not possible, what about directly call mp4box after recording to convert every h264-recording directly to an mp4-file. not to wait for a cron-time or any other trigger.

maybe here in the code, after "camera.stop.recording():
pi-timolo-h264

what do you think?

i looked into "inotifywait" (http://stackoverflow.com/questions/10533200/processing-data-with-inotify-tools-as-a-daemon), which seems a reasonably option.

but that would put another system across the lean pi-timolo.py solution.
so i thought to ask, for the developers opinion. ๐Ÿ‘

i would test something.. ๐Ÿ˜ƒ

regards,
tozett

Running really slow and does not really work. 6 minutes 2 pictures in motion dir and nothing in timelapse , is this expected?

Hi, I never use pi-timolo before, thus I don't know what the expected behavior is. I am running the latest fresh pi-timolo build in raspberry pi 2. It's running really slow. The cpu is not busy at all. I have no idea what pi-timolo was doing.
It took _1_ minute to see "Entering Motion Detect", another _3_ minutes to create ./motion/mo-cam1-1001.jpg and another _2_ minutes to create ./motion/mo-cam1-1002.jpg.
There is nothing in the directory timelapse.
I killed it after _6_ minutes running. I have no idea how this will work. I keep moving my body in the front of the camera during these 6 minutes.
I did test built-in commands raspistill -o test01.jpg -w 1920 -h 1080 and raspivid -t 20000 -o test01.h264 -w 1920 -h 1080. these commands are working fine.

PS: I ran this program once before. thus there is no mo-cam1-1000.jpg log in this time.

I read the issue "Takes 1 motion image then stops" comments, so I did modify config.py accordingly, but no luck.
Please check my complete config.py file at http://pastebin.ubuntu.com/14523004/
Please check the following outputs:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0
Codename:       jessie


 $ date
Sat 16 Jan 22:33:48 CST 2016
pi@pi2:~/pi-timolo $ ./pi-timolo.py
------------------------------ Loading Python Libraries --------------------------------------

Note: To Send Full Output to File Use command -   python -u ./pi-timolo.py | tee -a log.txt
      Set logDataToFile=True to Send checkIfDay Data to File pi-timolo.py.log

pi-timolo.py ver 2.8
-------------------------------------- Settings ----------------------------------------------
Config File .. Title=pitimolo default configuration motion and timelapse 1080p images
               config-template filename=pitimolo-default-config
Image Info ... Size=800x600   Prefix=cam1-   VFlip=False   HFlip=False   Preview=False
    Low Light. twilightThreshold=35  nightMaxShut=5.800 sec  nightMaxISO=800   nightSleepSec=10 sec
    No Shots . noNightShots=False   noDayShots=False
    No Text .. showDateOnImage=False  Text on Image Disabled
Motion ....... On=True  Prefix=mo-  threshold=10(How Much)  sensitivity=500(How Many)  forceTimer=60 min(If No Motion)
               motionPath=/home/pi/pi-timolo/motion
    Num Seq .. motionNumOn=True  current=1001   numStart=1000   numMax=500   numRecycle=True
               motionNumPath=/home/pi/pi-timolo/mo-pi-timolo.dat
    Quick TL . motionQuickTLOn=False  Quick Time Lapse Disabled
    Video .... motionVideoOn=False  Motion Video Disabled
Time Lapse ... On=True  Prefix=tl-   Timer=300 sec   timeLapseExit=0 sec (0=Continuous)
               timelapsePath=/home/pi/pi-timolo/timelapse
    Num Seq .. On=True  current=1000   numStart=1000   numMax=1000   numRecycle=True
               numPath=/home/pi/pi-timolo/tl-pi-timolo.dat
gdrive Sync .. On=True  Path=/home/pi/pi-timolo/pi-timolo.sync  Note: syncs for motion images only.
Logging ...... verbose=True (Details to Console)    logDataToFile=True  logfile=/home/pi/pi-timolo/pi-timolo.log
------------------------------------ Log Activity --------------------------------------------
20160116_22:34:48 Main - Entering Motion Detect - Time Lapse Loop  Please Wait ...

20160116_22:34:48 ..
20160116_22:36:33 checkForMotion - Found Motion - threshold=10 sensitivity=500 Exceeded ...

20160116_22:36:35   getNightCamSettings - dayPixAve=19 ratio=0.457 ISO=365 shut=2651428 2.651 sec
20160116_22:37:18   takeNightImage - Size=800x600 dayPixAve=19 ISO=365 shut=2.651 sec /home/pi/pi-timolo/motion/mo-cam1-1001.jpg
20160116_22:37:18   postImageProcessing - Next Counter=1002 /home/pi/pi-timolo/mo-pi-timolo.dat

20160116_22:37:18 ..
20160116_22:39:03 checkForMotion - Found Motion - threshold=10 sensitivity=500 Exceeded ...

20160116_22:39:05   getNightCamSettings - dayPixAve=20 ratio=0.429 ISO=342 shut=2485714 2.486 sec
20160116_22:39:48   takeNightImage - Size=800x600 dayPixAve=20 ISO=342 shut=2.486 sec /home/pi/pi-timolo/motion/mo-cam1-1002.jpg
20160116_22:39:48   postImageProcessing - Next Counter=1003 /home/pi/pi-timolo/mo-pi-timolo.dat

<I killed the program here>

Thank you very much.

Auto deleting old files

User should put config.py limit of disc size. When this size is reached, older files would gets automatically deleted to create space for the new motions.

Released ver 4.40 of pi-timolo.py for testing of simplified takeNightImage function logic for greenish image problem

pi-timolo.py release 4.40
Since an earlier update of the picamera python library and an associated camera driver update I have been getting greenish images at night and twilight. After testing I have simplified logic to allow camera to determine settings based on camera.framerate_range. This seems to have resolved the igreenish image issue, although some images are slightly darker than I would like. Please test this release and post a github issue if it works well or you discover problems. If everything is OK, I will cleanup unused functions and optimize. Will also add pixAve logging info somewhere since it is still used to determine day/night/twilight. Also want to set a lower pixAve setting to avoid camera taking black images when light level is very low.
Your comments are greatly appreciated ....
Thanks Claude .....

saveRecent gets stuck if it can't remove a file

First, thanks for all your work putting this together and publishing it! I ran into the following issue, which I think is worth reporting.

The saveRecent function catches errors when it tries to remove a file, but it does not remove the non-removable file from its list, so it tries to remove the same file over and over again.

This issue bit me because my NAS indexed the volume where I stored my pi-timolo images and left indexing metadata directories everywhere. In my case, there was a directory (@eadir) that could not be removed with os.remove and the logs filled with messages like:

2017-06-15 21:51:41 ERROR    saveRecent Cannot Remove /mnt/capture/recent/timelapse/@eaDir - [Errno 21] Is a directory: '/mnt/capture/recent/timelapse/@eaDir'
2017-06-15 21:51:41 ERROR    saveRecent Cannot Remove /mnt/capture/recent/timelapse/@eaDir - [Errno 21] Is a directory: '/mnt/capture/recent/timelapse/@eaDir'
2017-06-15 21:51:41 ERROR    saveRecent Cannot Remove /mnt/capture/recent/timelapse/@eaDir - [Errno 21] Is a directory: '/mnt/capture/recent/timelapse/@eaDir'
2017-06-15 21:51:41 ERROR    saveRecent Cannot Remove /mnt/capture/recent/timelapse/@eaDir - [Errno 21] Is a directory: '/mnt/capture/recent/timelapse/@eaDir'

pi-timolo release 7.0 Now uses OpenCV Motion Tracking

After looking at my speed camera code and having issues with pi-timolo previous motion detection false positives, I decided to change pi-timolo to use OpenCV and a simplified Motion Tracking. You can tune using track length trigger and min area. This code uses pi-camera streaming. I will look at adding web cam support but thought I would release this version first. I recommend you rename the previous pi-timolo and do a fresh install of vers 7.0.

I have pi-timolo.py with a single core RPI and it works just fine. I have trees moving at the front of my house and did get a few false positives but otherwise performs very well. I have added a QuickPic feature to capture steam images directly so the stream does not have to be stopped and restarted to take a full pi-camera image. QuickPic is a smaller image size but still good enough. I have also left trackingInfo setting to True, but I recommend you turn this off to reduce verbose logging.

Your comments would be greatly appreciated.
Thanks Claude ...

motion-video duration independent of motion?

hi,
i read the wiki about convid.sh and i think i misunderstood the conception of recording motion from motion-detection.

as far as i understand the wiki, a "motion" triggers only a videorecording for a fix period of time.
after that the process starts again in this way.

it is not that the video is recorded as long as there is somethin moving in the camera/scene.

am i right? is this by default/architekture of python-video.?
or is this the same with the linux "motion" binary?

or could it be coded (opencv?) that the recording is going on from first trigger to the end of a moving?

thanks,
tozett

Gdrive sync delay and a typo in config.py file

When I use the sync.sh script, it stay at "resolving" for near 4-5 min before uploading. Is there anything I can do to shorten that delay? Everything else work without any flaw.

......

little typo in config.py file. The directory to webserver script is "homw/pi/pi-timmolo/" should read home. Little correction.

Last error that I was unable to solve is probably because of my knowledge level. I had an error will executing the webserver.py script. Error with line 155 os.chdir(web_server_root). I put a # to disable the line and the websever was running after that.

Good work with this app. Thanks !

Add x seconds of video before motion occurs

First of all I must say this is a very good program!! Relatively easy readable as non-python programmer., and with a lot of functionality!!

It would be great if you could add following functionality:

In the ideal world I would also like following (maybe this should be splitted into separate issues)

  • smart motion mask; functionality like it is implemented in the linux motion program (see http://www.lavrsen.dk/foswiki/bin/view/Motion/ConfigOptionSmartMaskSpeed)
  • instructions on how to install your program under Arch linux (on raspberry pi (zero) of course). I did not managed to install all python modules, and was struggling between Python2.7 and Python3.

webserver.py not starting?

Hello Claude, I'm having an issue getting webserver.py to start and then continue running on the RPi 3. I've installed your latest release from December 14. Running ./webserver.py on the CLI reports "webserver.py is Running" and returns the PID. But netstat -tln can not find a server listening on port 8080 (but does find SSH on port 22), and pgrep can not find the PID that was returned by the webserver.py script. Attempts to reach the RPi at port 8080 from a browser on any other machine on my local network are met with the message "Connection Refused".

Any ideas on the cause, or recommendations to fix this?

Thank you,
Mono

hook for video files missing ... can i convert h264 to webm

hi,
i found your code very useful for my case,
but i am viewing my files in directory view of my local apache on the rasperry with this:
https://larsjung.de/h5ai/

but there is no web-support for h264 files, i would like to convert them after recording to mp4/webm with ffmpeg.
do you see a way to configure/or trigger a script for converstion after recording motionvideo.?

this way i could view the video in browser, like in motioneye..

(this: https://github.com/131/h264-live-player could be an option, but it would be limited to raspi)

thanks for help.
tozett

Release 5.00 with good transitions and extra features

Release 5.00 with good transitions and extra features

This release has pretty good day/night transitions. Added a nightDarkAdjust var to bump Dark night lighting if required. Improved logging messages. Added ability to suppress showDots especially when vidieo stream thread is enabled.
Added timelapseExitSec timeout and timelapseNumMax reached logic. These will suppress further timelapse images when setting is reached and display log message.
### To Upgrade
Rerun curl bash install script to update everything or Minimal upgrade from logged in ssh or terminal session) per commands below

cd ~/pi-timolo
cp config.py config.py.old
wget -O config.py https://raw.github.com/pageauc/pi-timolo/master/source/config.py
wget -O pi-timolo.py https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo.py

I Very Happy with this update. It has taken a while and a few partial revisions to achieve.
Let me know if you find any issues.
Claude ....

adding pi-timolo.sh to init.d causes RPI to restart every few minutes

I've been trying to get pi-timolo to autostart at boot so I've been following the instructions. When RPI first boots I can run ps -ef | grep pi-timolo and I see the python routine running but it dies after a few minutes and does not capture any motion. I completely re-imaged my SD card and started from scratch. All was well until I went through the instruction again to add pi-timolo.sh to /etc/init.d. Once I do this then my RPI is stuck in a reboot itself mode. I have attempted to remove the entry form init.d by running
sudo update-rc.d -f pi-timolo.sh remove

This apparently stops the pi-timolo.py service from running but it does not stop my RPI from restarting every few minutes.
The only way I know to fix the problem is to re-image the SD card, completely start from scratch and AVOID attempting to autostart pi-timolo.py

Thanks

Not saving pictures, test image gives error

Hi Sir.
I am getting trouble when running the pi-timolo.py script. While test image is set to true it gives me the following error:
IOError: [Errno 2] No such file or directory: '/home/pi/pi-timolo/takeTestImage.jpg'
and when its set to false it never saves an image or notifies that its picking up motion... Did I maybe do something wrong?

motion unfocused

One of my cameras running pi-timolo saves unfocused motion pictures but saves focused timelapse pictures. Is the imagewidth and imageheight different for those tho options?

Combine motion and timelapse

Thanks for the excellent program, worked right out of the box for me ๐Ÿ‘

Would it be possible to combine motion detection and timelapse in order to create a timelapse movie that updates more often when there is motion? You can see what I had in mind here:
https://youtu.be/gyeTsl8ghcQ?t=3m

I like the effect, allthou the street in the video is a bit too busy to see the effect very clearly :-)

makemovie.sh --avconf destination path

hi,
after modification of the destination path, the movie was still created in the pi-timolo homedir.
may there should be destination-path-variables in the avconv line?

timolo-make-movie

โ”

convid.sh with delete of original files = deletes original creation date

hi,
as i am playing with convid.sh i am observing that the file creation time on the new mp4 files is the creation time of my mass-conversion date, ie. hour:minute.
here i am loosing the original recording date (hr:min) from the original h264 file.

maybe you want to consider building in the original source an option to transfer the date,time,minute to the converted file (before deletion)?

apreciate your opinion,
regards
tozett

unable to pull files

I get an error when trying to pull files from my drive,

It says that it "failed for url "https://googledrive.com/host/[jibberish]". StatusCode: 404

It will pull the file name, but the file is 0 bytes.

Is there an update needed? How could I get that? Any ideas would be appreciated. Thanks.

Pi NoIR camera

Despite extensive fussing over the sensitivity, threshold, and motionAverage settings of config.py of pi-timolo, I experience many false positive motion events with the NoIR pi camera. The regular pi camera works well.

Have you or others found the pi NoIR camera to work acceptably with pi-timolo? If so I will continue to try to tune the variables in config.py

Great application!
Thanks,
Carter, a loyal follower of your project

numbering scheme for images/motion

hi,
as i look up the folder with the saved motion-video and image files daily (i am trying to use pi-timolo) as some kind of surveillance-cam), the files are numbered from 1000 upwards.
at the moment i try this with directory browse (for some other reasons), and not with your webserver...

on my small mobile display i see the file-name and get no clue at wich time the video/image was shot.

do you think it could be an option to have a choice of single-counting the images/video upwards or get a counting-number in the scheme of YEARMONTHDAYTIME (201701110525). or maybe even more human readable like 2017-01-11-0525 โ”

screenshot_20170110-124949

what do you think? ๐Ÿ’ญ

Release 4.70 with improved takeNightImage with better low light. Should resolve most greenish image problems

This version must have the revised config.py file. pi-timolo.py release 4.50 has improved night low light and should resolve most green images issues. I have done testing with an indoors and outside facing camera. There is still room for tuning. There are lighting bumps between day and night transitions. I thought I would release this version so others can work with it and let me know any issues.
minimal upgrade is (from logged in ssh or terminal session)

cd ~/pi-timolo
cp config.py config.py.old
wget -O config.py https://raw.github.com/pageauc/pi-timolo/master/source/config.py
wget -O pi-timolo.py https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo.py

It is recommended that you have the latest raspbian firmware. Older firmware may work but I have not tested this. I have only tested on up-to-date raspbian and firmware.

sudo rpi-update

Let me know how this update is working for you.

Thanks for your support
Claude ....

Has this been tested with Python 3 ?

Struggling to get this code working. I'm starting to wonder if it has been tested with Python 3. I'm trying with Python 3.5.2 and getting all sorts of errors. This is the latest.

Main()
File "./pi-timolo.py", line 712, in Main
takeNightImage(filename)
File "./pi-timolo.py", line 410, in takeNightImage
logToFile(dataToLog)
File "./pi-timolo.py", line 131, in logToFile
f.write(filecontents)
TypeError: a bytes-like object is required, not 'str'

8-May-2017 - pi-timolo.py release 6.0 with sub-folders, recent files and disk space management

8-May-2017 - pi-timolo.py release 6.0

This upgrade include the following options.

  • Option to use threaded video streaming for motion detection. This speeds image frame rate (ver 5.0)
  • Option for creating DateTime named motion and/or timelapse subfolders with new folder creation triggered by MaxFiles or MaxHours settings.
  • Option for maintaining a specified number of the most recent files in separate motion or timelapse recent folders
  • Option to manage disk space by deleting older files. A free space setting is used as trigger for deletion of oldest files

Note - This will require the updated config.py file.

You can perform a Minimal upgrade if you have a recent installation

cd ~/pi-timolo
cp config.py config.py.old
wget -O config.py https://raw.github.com/pageauc/pi-timolo/master/source/config.py
wget -O pi-timolo.py https://raw.github.com/pageauc/pi-timolo/master/source/pi-timolo.py  

Edit the new config.py to transfer any previous customized settings

Claude ....

Error when trying to run/setup grive

I am receiving this error in terminal:

./grive: error while loading shared libraries: libboost_filesystem.so.1.49.0: cannot open shared object file: No such file or directory

I think it must be some type of linking issue. Any idea?

feature-request: timelapse-movie, archive images

hi,
i made a movie from the timelapse-images. fantastic. ๐Ÿ›ฉ
as i thought of now let the rasperry make a daily movie from timelapse-images, so i could makemovie.sh run from cron (like the wiki shows).

did you consider to delete timelapse-images after finishing the movie?

like in the convis.sh script the deletion of the original .h264 after convertion to mp4?
or move all the daily timelapse-images after making the movie to an daily/montly archive-folder?

for me this would be a nice feature. so i could let cron make a daily timelapse movie and the script renames the folder to an daily archive, or moves the images there into.

what do you think โ”

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.