Frame Number in timestamp?

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

Frame Number in timestamp?

Post by Laevi »

Hi,

i was wondering if it was possible to add the frame number of the image to the image timestamp. I've searched the source code and looked on forum but couldn't find any information.

Thanks in advance

:: edit ::

I'd be happy enough if someone could tell me where the '%%s' (Monitor Name) is coming from. Knowing that adding the frame id is no problem, but i cant find it.
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

the name is the monitor name in the monitor
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
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

I know, but i want to know how and where you put the monitor name from the database into the '%%s'-variabel
jameswilson
Posts: 5111
Joined: Wed Jun 08, 2005 8:07 pm
Location: Midlands UK

Post by jameswilson »

not sure on the frame thing and maybe im missing the question but from the manual
Timestamp Label Format – This relates to the timestamp that is applied to each frame. It is a ‘strftime’ style string. It is actually passed through strftime and then through printf to add the monitor name so a format of '%%s - %y/%m/%d %H:%M:%S' (note the double % at the beginning) would be recommended though you can modify it if necessary. If you don’t want a timestamp or have a camera that puts one on itself then leave this field blank. If you add a second %%s placeholder in the string this will be filled by any of the ‘show text’ detailed in the zmtriggers.pl section.

Timestamp Label X/Y – The X and Y values determine where to put the timestamp. A value of 0 for the X value will put it on the left side of the image and a Y value of 0 will place it at the top of the image. To place the timestamp at the bottom of the image use a value eight less than the image height.
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
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

I want to get a timestamp that looks like:

Code: Select all

Cam1 - 2007/10/17 18:12:34 (frame 34)
But i want to know where or how the 'Cam1' is implemented into the '%%s' so i can add the frameid in the timestamp with the same method.
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

Still stuck with this issue. :shock:

Code: Select all

void Monitor::TimestampImage( Image *ts_image, time_t ts_time ) const
{
	if ( label_format[0] )
	{
		static int token_count = -1;
		static char label_time_text[256];
		static char label_text[256];

		if ( token_count < 0 )
		{
			const char *token_ptr = label_format;
			const char *token_string = "%%s";
			token_count = 0;
			while( token_ptr = strstr( token_ptr, token_string ) )
			{
				token_count++;
				token_ptr += strlen(token_string);
			}
		}
		strftime( label_time_text, sizeof(label_time_text), label_format, localtime( &ts_time ) );
		switch ( token_count )
		{
			case 0:
			{
				strncpy( label_text, label_time_text, sizeof(label_text) );
				break;
			}
			case 1:
			{
				snprintf( label_text, sizeof(label_text), label_time_text, name );
				break;
			}
			case 2:
			{ 
				snprintf( label_text, sizeof(label_text), label_time_text, name, trigger_data->trigger_showtext );
        break;
			}
		}

		ts_image->Annotate( label_text, label_coord );
	}
}
Anyone can help me with this, is it possible to replace the 'trigger_data->trigger_showtext' with the frame number given when an event is made? (so it displays the frame number when images are stored in the database instead of the showtext part in the trigger for the second '%%s')

I know i can copy paste the TimeStampImage part and split it up for GetImage and Streams so it will only execute the second '%%s' part when an event is made but how to get the frame number in there without getting strlen errors etc...? :?

Anyone can help me get on the right track here?

Thanks
Laevi
Posts: 42
Joined: Mon Aug 27, 2007 1:50 pm

Post by Laevi »

Seems like nobody has answers when people have real questions.
Got it to work anyway - :evil:
User avatar
MJN
Posts: 262
Joined: Wed Jan 17, 2007 10:29 am
Location: Wiltshire, UK

Post by MJN »

Don't spit your dummy out - post your solution to help others.

Mathew
User avatar
Lee Sharp
Posts: 1069
Joined: Sat Mar 31, 2007 9:18 pm
Location: Houston, TX

Post by Lee Sharp »

Tghis may seem odd, but I generally do not reply to posts where I don;t have an answer. Perhaps no one had tried what you wanted to do.
remembermyname2000
Posts: 13
Joined: Fri Dec 04, 2009 3:41 pm
Location: Atlanta GA

Re: Frame Number in timestamp?

Post by remembermyname2000 »

Has anyone figured this out or can post how to display event and/or frame number? Or is there a way that the event/frame number can be super imposed onto each still and placed by X / Y like the time stamp? It would be nice to have this as an option in the configs.
Post Reply