Page 1 of 1

Filter to convert event to video and remove JPEGs?

Posted: Sun Jul 26, 2015 5:35 pm
by ExplodingLemur
I have Zoneminder currently running in continuous record mode. It creates a new event every 10 minutes. For every 10-minute event, I'd like to convert the JPEGs (from the MJPEG stream off my cameras) to a video file, and remove the individual JPEG image files (this should reduce my disk usage by about 90% for each event). In the Filter setup window I can set up a filter to match all events >=600sec, and there are checkboxes for "Create video for all matches" and "Delete all matches"...however, I suspect that the delete all matches option will delete the event entirely, converted video and all. I could execute "rm %EPI%/*.jpg" for all matches as well as create video for all matches, but I don't know what order it executes these in, and if it does execute the video creation first, I don't know if it waits for ffmpeg to return a successful exit code before moving on to the custom command. Any thoughts?

Re: Filter to convert event to video and remove JPEGs?

Posted: Sun Jul 26, 2015 7:43 pm
by mikb
I've no idea if the delete and video creation will work in the way you say, in that delete will blow away the newly made video (or delete the JPGS and then fail to make a video!)

What I do know is this: If you force the videos to be created OUTSIDE the usual ZM event directories, it doesn't get deleted.

This is what I do :-

I have a rule that takes "archived" events and makes videos of them (7 days after they originally happened, giving a 7 day opportunity to realise i want to keep something).
I have a rule that says if it's NOT "archived" and 7 days old, delete it.
I have a rule that says if it's "archived" and 14 days old, delete it.

The events disappear and my videos are left behind where I want them.

Configure Options/Images/FFMPEG_OUTPUT_OPTIONS and set (was just "-r 25" here)

# Comments added by me

-r 25 -q:v 1 -f avi -vtag XVID -g 30 -bf 2 # File type formatting
-vf "hqdn3d,lutyuv=y=gammaval(1.4),unsharp" # Image improvements
/mnt/point/for/cctv/zoneminder/videos/`date -d "-7 days" +"%Y%m%d-%H%M%S-%N"`.avi # Full Path with filenamed by date of "7 days ago from now"

The important thing there is I specify the path where I want the video to end up.

Now, you can use whatever naming convention you want after "videos/ .... .avi" but I can assure you the videos created "over there" don't get deleted even when ZM cleans up.

Re: Filter to convert event to video and remove JPEGs?

Posted: Mon Jul 27, 2015 12:38 am
by ExplodingLemur
That's not quite what I'm looking for, because I want the video files to stay with the events, and get cleaned up by Zoneminder when it's time to expire them, or the disk gets full. All I want is for each event to create an MPEG or AVI and drop the JPEGs after Zoneminder has moved on to recording in the next event.