Option to merge events when creating mpgs

Anything you want added or changed in future versions of ZoneMinder? Post here and there's a chance it will get in! Search to make sure it hasn't already been requested.
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Option to merge events when creating mpgs

Post by Blazer »

Zoneminder just paid off this weekend, as it captured "something" important that happened (I wish I could tell but I cannot).

I have run into a problem (that has a partial solution) when I wanted to dump these events to mpg so they could be handed over as evidence.

The event lasted about 5 minutes, and although the subject never left the range of the camera during that time, ZM recorded over 300 seperate events.

Exporting all of these events to video seemed like a chore from the web GUI (would have to do them one at a time), so I used zmvideo.pl to do it for me. The events I needed to convert to mpg were events 628-884.

Code: Select all

for event in `seq 628 884` ; do /usr/lib/zm/bin/zmvideo.pl  -e $event; done
After this I now had a seperate mpg file for each event, that I could copy to a single directory:

Code: Select all

 find /usr/lib/zm/html/events/1 -name *.mpg -exec mv {} /tmp/MPEGs \;
So there I have all of the mpegs in one directory, now I had to find a linux tool that could splice them all together. I found a tool called "mpgtx" that could do it.

So...this was a lot of work to create a single video of several events...it sure would be nice to have an option in the video creation GUI to checkbox several events and create either seperate or a single large video of them.

P.S. The partial solution I spoke of, was I increased my "post event image buffer" size, which, according to the docs, should help reduce the problem of lots of small events happening, and instead create longer events when there is sporadic short movements.[/code]
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

I'm glad you managed to get some success with ZM, though can't you even give us a hint what you go? :D

Your partial solution is definately the best one at present as it doesn't use more buffer space or anything, just gives each event a longer tail. The option to merge events is on the to-do list and will get in as soon as I have made sure that each component is able to cope with events that may have a discontinuity in the middle.

Phil
User avatar
Blazer
Posts: 234
Joined: Sun Jun 05, 2005 12:57 pm

Post by Blazer »

I have had ZM running to prevent theft, but it caught something totally different. Basically a maintenance person decided to do some drugs and pleasure themself in someones office :o You can only imagine my surprise upon reviewing the events in the morning...instead of the same old events of the cleaning crew vacuuming etc, I find someone drugging up and whacking off, lol.

Thanks to ZM, he won't be coming back for a repeat performance. Now I'm off to buy some more disenfectant.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Charming.... :lol:

Are you cameras hidden or did he think he was auditioning for something?

Phil
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

:lol: another bloody wanker, At least you know to get rid of him. You now things are dissapearing for sure or will be soon.

Regards,
Corey
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Very funny story - I guess there are other interpretations to the task "maintenance" :).

What is the recommended "post event image buffer" size indeed? I'm getting a lot of small (0.5-2) seconds events, and would like to decrease their number. Will doubling the default number, from 10 to 20, help in this case? Also, is there any way to set a global option, or I need to increase the post event buffer on every camera?
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

every camera mate, and what you set it to depends on your frame reate, if your at 25fps captureing 10 post event frames wont eben be half a second but at 1 fps would be 10 secs
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

The other thing you can try is to reduce the reference image blend %ge. This controls how fast an image is merged into the reference image. If this is large then a new image is merged into the reference very quickly, so someone standing in front of the camera becomes part of the background. If this is small then the reference image is much more static and so someone in the field of view will stand out for a lot longer causing an event to persist.

I think the default is 10%, try 5% or possibly even less.

Phil
SyRenity
Posts: 301
Joined: Mon Jan 24, 2005 2:43 pm

Post by SyRenity »

Hi.

Thanks for the tips.

Setting the post event buffer caused the number of events per hour to be 2x smaller. The events are longer now (in fact they reach 10, even 15 sec. length). Perhaps, setting it for even a longer value, will allow having optimal length events?

I have 5fps coming from this camera, so does buffer of 20 means that each event will have in average 4 seconds for another alert, in order to be prolonged? Kind of small, nope - perhaps 10 secs would be better?

I'll also try to set the reference % for another camera (which has the default 10 buffer), and see how it compares to the buffer method.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

im currently adding this to zm4ms as its not that hard to do. It will(is) going to work by pulling all archived events together. Now 1 problem i currently dont write to the db with my app so you would have to archive them from the web interface first then run the all events export in zm4ms. It will be in the beta version i will post it in the contribs when i think im happy with it
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

Have added this now to zm4ms beta it will join all archived events together as 1 vid
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Koenzie
Posts: 29
Joined: Mon Dec 12, 2005 8:53 am

Post by Koenzie »

I dont't know if i mean the same thing as the topicstarter but maybee you can make it possible to check the event you want to join in the event window and then click a join button to join them all to display just as one event. This for the same reasons as the TS mentioned. I have 450 events from 1 person in our center. This person is comming back every day so every day i get 450+ events. I want to join then so that i can archive only one event.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

this coule be done manually i think, (for the time being if its urgent etc) with some db editing and moving and renaming.

Find the first event and note its event id.
Browse to your events folder and open the relevant folder.
eg

event 55
we need to add 56, 57,58 and 59 to 55
55 has 40 images
56 has 30 images
57 - 59 have 20

in folder 55 there will be 40 jpegs numberes 001 - 040
open folder 56 rename as 041-070
56 rename as 071-100 etc etc
copy/move other image files to folder 55
edit db to take account how many images are now in this event and adjust the length to match the new timeframe.

Oh and this will take a while lol especially as you have 450 events, maybe somewone who knows could make a script that did the moving and renaming and did the sql change.
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Koenzie
Posts: 29
Joined: Mon Dec 12, 2005 8:53 am

Post by Koenzie »

jameswilson wrote:this coule be done manually i think, (for the time being if its urgent etc) with some db editing and moving and renaming.

Find the first event and note its event id.
Browse to your events folder and open the relevant folder.
eg

event 55
we need to add 56, 57,58 and 59 to 55
55 has 40 images
56 has 30 images
57 - 59 have 20

in folder 55 there will be 40 jpegs numberes 001 - 040
open folder 56 rename as 041-070
56 rename as 071-100 etc etc
copy/move other image files to folder 55
edit db to take account how many images are now in this event and adjust the length to match the new timeframe.

Oh and this will take a while lol especially as you have 450 events, maybe somewone who knows could make a script that did the moving and renaming and did the sql change.
Manually this is a hell of a job.
I really need this because i cant browse trough more then 2000 events evry day
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

its easyish to make an mpeg from multiple events, where its hard (we need zm changed on the server) is to actually move all these events into 1. I understand what you mean regarding the number of events as the manual approach is unworkable for lots of events as it would take hours.
I fall you need is an mpeg of multiple events we can do that but outside of zm. If its added to the wish list for the server (unless you can write fluant c) we will have to wait till phil has time to add it.
I dont know an easy way to do this, forget how it will be writtenb but how it will work. Im assuming the db will need another flag to allow multiple events to be selected a join flag enabled then zm would have to move and rename the images and update the event info in the db to actully make 1 event.

If the info you require is for somwthing legal, the police wont accept jumps in time between events. As you have indicated it appeas you have multiple events that are in fact contious (in a time way) then this will be acceptable. If there are jumps in time (ie even 10 seconds) the defence would leap on this as it wouldnt be continues footage and what happened in the gaps etc

Just a note of caution really, we have been stung by this before.

James
James Wilson

Disclaimer: The above is pure theory and may work on a good day with the wind behind it. etc etc.
http://www.securitywarehouse.co.uk
Post Reply