This script makes an video file from every event within the last 24 hours. it's sorted by monitor name and offcourse also by time.
It's original is not from me but I alter it for zoneminder 1.25.0 and Ubuntu 11 server.
So here's and small explanation for the script
<<<Look at the last postings for modifications and the file!>>>
Step 1: make an parameter for all of the active monitors that has events:
Code: Select all
# Enumerate existing ZoneMinder Monitors
cameraname=(`ls /var/www/zm/events/ | grep '[a-zA-Z]'`)
cameraList=(`ls /var/www/zm/events/ | grep '[0-9]'`)
cameraNum=${#cameraList[@]}
eventsFolder=/var/www/zm/events/
echo Number of detected ZoneMinder Monitors: ${#cameraList[@]}
# Start working through all detected ZoneMinder Monitors
# The camera's get the name from the directory symlink on alphanumeric order!
# Alter every parameter entry BELOW THIS LINE called {cameraname[$i]} to ${cameralist[$i]} if you don't want this.
for (( i=0; i<${cameraNum}; i++ ));
do
echo Doing ZoneMinder Monitor: ${cameraname[$i]}
Code: Select all
# Get a list of images for the last 24 hours from each of the detected ZoneMinder Monitors.
find $eventsFolder${cameraList[$i]} -mtime -1 -name \*capture.jpg > /tmp/alarmvideos/${cameraname[$i]}.list
# Sort output file for a consistent movie
sort /tmp/alarmvideos/${cameraList[$i]}.list -n -o /tmp/alarmvideos/${cameraList[$i]}-sorted.list
Memcoder has an load of options. This string (default) wil make an avi file with an screensize from 640*480 and no audio
Code: Select all
# Encode each 24hr events into a movie Mpeg4 (edit with&hight and path for your cam settings)
mencoder mf://@/tmp/alarmvideos/${cameraname[$i]}-sorted.list -mf w=640:h=480:fps=5:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -ofps 5 -oac copy -o /tmp/alarmvideos/`date +%d`-${cameraname[$i]}.avi
Code: Select all
# create directory for year and month (if it's nog existing)
mkdir -p /YOURARCHIVEDIRECTORY/images/videos/`date +%Y`/`date +%m`/
# Find avi's with actual events-move to new dir
cd /tmp/alarmvideos
find *.avi -size +5k -exec mv {} /YOURARCHIVEDIRECTORY/images/videos/`date +%Y`/`date +%m` \;
- * unzip the file
* rename the file from .txt to an .sh extension
* upload the file and create an directory on your linux server (like /usr/scripts)
* edit the paths of your zoneminder events. (default in script : /var/www/zm/events )
* edit encoder format settings to your own preferences. (default = mpeg4, 640x480, 5 frames/sec)