Security Camera BASH script to merge Zoneminder events into mp4 videos

The following script is a BASH (Bourne Again Shell) script that will take zoneminder camera events and merge them into mp4 videos that can easily be archived, or viewed.  The script will also ftp the resultant videos to a remote ftp server.

Zoneminder is a bit cumbersome to locate a particular event or time using the mysql events, or the ZM timeline, but this script streamlines that a bit, allowing you to use VLC or whatever and speed it up to ‘scan’ your day’s or week’s events…..

Very easy to configure as everything is set up using variables.  The script will create a directory name of the current date that it’s run under your home directory, or wherever you choose.

I have it set to run as a cron event daily, but you can set it to run weekly or how often you choose by changing the mtime value, and configuring the cron event to match.

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

Download [4.13 KB]

So as not to fill up the FTP server, I wrote a prune command that will delete those videos older than 60 days.  Also set to run as a cron event on the FTP server.  It will accept the following syntax:

/path.to.prune/prune </directory.path.containing.video.directories/

Loader Loading...
EAD Logo Taking too long?

Reload Reload document
| Open Open in new tab

Download

You will need to strip the .txt from both scripts and set them to chmod 700 and run them under the cron of the proper user.