pageauc / speed-camera

A Unix, Windows, Raspberry Pi Object Speed Camera using python, opencv, video streaming, motion tracking. Includes a Standalone Web Server Interface, Image Search using opencv template match and a whiptail Admin Menu Interface Includes picam and webcam Plugins for motion track security camera configuration including rclone sync script. watch-app allows remotely controller camera configuration from a remote storage service name. Uses sqlite3 and gnuplot for reporting. Recently added openalpr license plate reader support.
Apache License 2.0
987 stars 173 forks source link

Images filling up sd card #101

Closed johncohn closed 3 years ago

johncohn commented 3 years ago

is there a good way to get speed cam to periodically clean up old images and other artifacts ? I'm finding that every week or so my pi crashes because the sd card is full.. I seems to be old image files taking up most of the space. It would seem that everyone would eventually have this problem. Is there any easy fix ? Eg.. do I need to set up a cron job to periodically clean out the images ?

pageauc commented 3 years ago

Speed Camera has space management feature. See config.py settings per default sample below

# Optional Manage Free Disk Space Settings
# ----------------------------------------
spaceTimerHrs = 0             # Default= 0  0=off or specify hours frequency to perform free disk space check
spaceFreeMB = 500             # Default= 500  Target Free space in MB Required.
spaceMediaDir = 'media/images'  # Default= 'media/images'  Starting point for directory walk
spaceFileExt  = 'jpg'         # Default= 'jpg' File extension to Delete Oldest Files

Set spaceTimerHrs variable to hours between space checks eg 82 hours. Do not set frequency too low since it can affect speed camera performance. Also I would set to an hour value that would put it in the night time (based on start of speed-cam.py) Note my example would normally run check at night if started during mid to late day

Set the required free space in megabytes or leave default value The rest should be OK for defaults. Note this does not update the sql database entry for the deleted items.

This has been tested but not extensively since I run my Speed Camera's from attached TB size SSD, SATA USB hard drives.

Let me know if this answers your question.