Query for video in ZoneMinder

Support and queries relating to all previous versions of ZoneMinder
Locked
ditostil
Posts: 5
Joined: Thu Oct 04, 2007 4:51 pm
Location: Greece

Query for video in ZoneMinder

Post 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.
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post 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);
}
Last edited by Laevi on Mon Oct 08, 2007 1:31 pm, edited 1 time in total.
ditostil
Posts: 5
Joined: Thu Oct 04, 2007 4:51 pm
Location: Greece

Post 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!
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

So turn 'StartTime' into 'EndTime' and you're done, or am i misunderstanding what you want to do..
ditostil
Posts: 5
Joined: Thu Oct 04, 2007 4:51 pm
Location: Greece

Post 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.
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

So this should be what you're looking for then? all events that start and end in the time you enter.. :roll:

Code: Select all

$query = "SELECT * FROM Events WHERE StartTime OR EndTime BETWEEN (insert begin datetime here) AND (insert end  datetime here)";
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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
ditostil
Posts: 5
Joined: Thu Oct 04, 2007 4:51 pm
Location: Greece

Post 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
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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 #).
ditostil
Posts: 5
Joined: Thu Oct 04, 2007 4:51 pm
Location: Greece

Post 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
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post 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.
Locked