Recently we’ve started reconstruction of an old barn that’s part of our estate. And I love doing time-lapses of events like these; however as I am getting older, I am also getting lazier to setup GoPro every time. So I was a little sad, but then I realized that I had two cameras pointed in the right direction already! (And luckily in time for all of the events not to be overwritten yet, since I only have 5 day buffer before the oldest events get overwritten).
All I needed to do was to figure out how to quickly and easily dump all of the events for further processing in Premiere.
Exporting event as x264 video
There are many, many, many ways how to do that in ZoneMinder, from easy ones to more complex ones. This is one is one of the easiest ways, more suitable for manual export of single events every once in awhile.
Note: This mainly relates to older ZoneMinders where event’s frames are stored as separate .jpg on the disk. Newer versions of ZoneMinder can save direct x264/x265 passthrough stream from camera, where this might be different., possibly way easier. (?)
Anyway, the export is actually very easy once you know the directions:
- Make sure you have
avconv
installed on your server (if not,apt-get install libav-tools -y
) - In ZoneMinder, go to
Options/Images
, where- Make sure OPT_FFMPEG is checked
- Set PATH_FFMPEG to
/usr/bin/avconv
- FFMPEG_OUTPUT_OPTIONS will have*
''-f mp4 -vcodec libx264 -threads auto -b 2000k -c:v libx264 -preset ultrafast /mnt/raid6_storage/zoneminder-x264-exports/`date +"%Y%m%d-%H%M%S-%N"`.mp4 < /dev/null''
- And finally in FFMPEG_FORMATS you can replace all with just
mp4
.
*Commands in step 3 can be further edited. These by default will dump exports in /mnt/raid6_storage/zoneminder-x264-exports/
(my folder that I can easily access via samba on my Windows/Mac machines) named by time and timestamp to avoid collisions (the time is when the export has started, not the time when the event was recorded). However for my purposes this is ok as this dumps events in order.
If you erase the path (e.g. you’ll leave only -f mp4 -vcodec libx264 -threads auto -b 2000k -c:v libx264 -preset ultrafast
), it will be saving the mp4 files directly next to the event in ZoneMinder .../zoneminder/events
location.
If you only need to export single event every now and then, I recommend not including the path, but if you need to batch export 400 events, I find it easier to just dump them all into the same folder (and then go back to the setting without path).
Exporting single event
In ZoneMinder UI, open the replay of the event you want export. Directly above the video, there is menu which ends with Video. Click on that, then on Export and wait. On my machine, 10-minute long 1920×1080 event with 7 fps takes about 6 minutes (Intel i5).
Exporting multiple events
Now I have all of the events I need to export set as Archived. If you create filter similar to this and hit Execute, it will batch-process all matching results:

Once you are confident everything is working as it should, you can even export video and then delete the events in one go by checking the “Delete all matches” as well.
Long-term timelapse
Since we are dealing with time-lapses, I might as well mention this. If you want to capture really long-term time-lapse of something, it’s easier to separately save about 5-10 frames a day via crontab and then assemble the time-lapse manually.
Current single from from ZoneMinder can be accessed via:
http://IP/zoneminder/cgi-bin/nph-zms?mode=single&monitor=5
So you can whip up a quick shell script which you can call from cron few times a day:
#!/bin/sh
today=`/bin/date '+%Y-%m-%d-%H-%M-%S'`;
wget "http://IP/zoneminder/cgi-bin/nph-zms?mode=single&monitor=10" -O /mnt/raid6data/barn-timelapse/$today.jpg