Page 1 of 1
Query for video in ZoneMinder
Posted: Fri Oct 05, 2007 5:25 pm
by ditostil
Hello,
I'm trying to find out how you can query for video in ZM.
For example, I want to get the results of all the videos that have been recorded yesterday between 1:00 and 3:00, and then retrieve these.
Any Help.
Posted: Mon Oct 08, 2007 8:51 am
by Laevi
Hi, you can try this:
Code: Select all
@ $conn = mysql_pconnect( localhost, zmuser, zmpass );
mysql_select_db( zm, $conn);
$query = "SELECT * FROM Events WHERE StartTime BETWEEN (insert begin datetime here) AND (insert end datetime here)";
$result = mysql_query($query, $conn);
if ($result) {
$num = mysql_numrows($result);
}
Posted: Mon Oct 08, 2007 12:21 pm
by ditostil
Hi, thank you very much for your reply,
In fact the above will return all the events that started between the specified times, (or not?).
I was wondering if there was a way that I could get the events above and also the events that started earlier and continued after the start time of the query.
Thanks again!
Posted: Mon Oct 08, 2007 1:50 pm
by Laevi
So turn 'StartTime' into 'EndTime' and you're done, or am i misunderstanding what you want to do..
Posted: Mon Oct 08, 2007 3:17 pm
by ditostil
Sorry maybe I didn't describe it well.
I want to get everything that has been recorded in a time window.
An event that may has started in this window, has ended in this window, and an event that may has started and ended outside the time window but was being recorded during the window.
I hope I expressed it this time right.
Thanks for your time.
Posted: Tue Oct 09, 2007 7:54 am
by Laevi
So this should be what you're looking for then? all events that start and end in the time you enter..
Code: Select all
$query = "SELECT * FROM Events WHERE StartTime OR EndTime BETWEEN (insert begin datetime here) AND (insert end datetime here)";
Posted: Tue Oct 09, 2007 8:14 am
by cordel
Open a filter window, and enter your variables as:
Date/Time greater than or equal to -24 hours
and time greater than or equal to 13:00
and time less than or equal to 15:00
Posted: Tue Oct 09, 2007 8:41 am
by ditostil
Hi, please check this:
Code: Select all
start
time
(event)
| |
--------------------------------------------------
| | |
|event | |
--------------------------------------------------
| |
start time (query) end time (query)
|---------------------------------|
|
|
I want this result and this part of the video
Thanks
Posted: Tue Oct 09, 2007 8:45 am
by cordel
What I gave above is as close as your going to get. You can export the results but will not be one video file.
You can add one more line to get from just one monitor (and monitorID equal to #).
Posted: Tue Oct 09, 2007 9:35 am
by ditostil
Sorry for your time, one final question,
If I'm getting it right you can only filter the events that have started or ended in a specific time window?
For example, ZM is recording all night long, and the next morning I want to get 3 specific minutes from last night's recorded video. Is there an automated way I can do this ?
Thank you very much
Posted: Tue Oct 09, 2007 9:43 am
by cordel
You can query for the time frame using a simular query in the filter as above, but it will return the entire event(s) that fit that time frame, not just the three minutes. If for instance you have a 5 min event that falls in that time you would get the whole five minute event. If there are two events that lap in that time, then the query would return both events.