anagramster
Posts: 2
Joined: Tue May 19, 2015 1:43 pm

raspistill annotate date

Tue May 19, 2015 2:42 pm

raspistill --annotate "$(date)" --timeout 20000 --timelapse 10000 --output %04d.jpg

The date never changes!
Same problem with raspivid.

Tried:
raspistill --annotate "$(pwd)" --timeout 20000 --timelapse 10000 --output %04d.jpg
and it works.

Also:
raspistill --annotate "$(./stamp.sh)" --timeout 20000 --timelapse 10000 --output %04d.jpg
where stamp.sh is:
#!/bin/bash
date '+%F at %H:%M:%S'
but it does not work (yes, it's chmod 755, and there is no error, just nothing shows in the annotation)

Questions:
- is $(...) a general exec mechanism? If not, what are valid keywords?
- how do we get this executed on every still?

For raspivid, not sure how to best express the update frequency, but it would be desirable.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20946
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspistill annotate date

Tue May 19, 2015 3:39 pm

In all your cases, the date is recovered from the system then sent to raspistill to use when it starts up. It is not update during the run - raspistill just sees it as a string of text it has been sent.

There is an annotate options to insert a real time date - use that instead. Cannot remember the exact syntax though...

edit: Just realised that the documentation is completely missing any annotation data. I'll have to update it when I get the chance.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20946
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspistill annotate date

Tue May 19, 2015 3:52 pm

Ok,

Time
--annotate 4

Date
--annotate 8

Time and Date (note, 4 + 8)
--annotate 12

This is the full set of bit fields, try them out!

/// Annotate bitmask options
/// Supplied by user on command line
#define ANNOTATE_USER_TEXT 1
/// Supplied by app using this module
#define ANNOTATE_APP_TEXT 2
/// Insert current date
#define ANNOTATE_DATE_TEXT 4
// Insert current time
#define ANNOTATE_TIME_TEXT 8

#define ANNOTATE_SHUTTER_SETTINGS 16
#define ANNOTATE_CAF_SETTINGS 32
#define ANNOTATE_GAIN_SETTINGS 64
#define ANNOTATE_LENS_SETTINGS 128
#define ANNOTATE_MOTION_SETTINGS 256
#define ANNOTATE_FRAME_NUMBER 512
#define ANNOTATE_BLACK_BACKGROUND 1024
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

anagramster
Posts: 2
Joined: Tue May 19, 2015 1:43 pm

Re: raspistill annotate date

Sat May 23, 2015 6:28 pm

I must have inadvertently flipped a bunch of those bits on when I did:

$(date +%F)

Because I got all sorts of real-time metering of camera params.

However, would it be possible to enable a mechanism similar to what I was hoping for??
That is, maybe something like:

@(N,'shell cmd')

Where every N frames, the shell cmd would be run.
Or perhaps something a little more efficient, like a write/read on a pipe (if the 'shell cmd' started with '|').
It would be async, so whenever a response/output is received, it updates the annotation.
Any delayed response would delay the next write/notify, such as N=1 on a high fps video.

This could work for both raspistill and raspivid.

tgwaste
Posts: 41
Joined: Thu Jan 31, 2013 7:15 pm

Re: raspistill annotate date

Wed Jun 17, 2015 8:56 pm

I would love the documentation on these parameters especially pertaining to: --annotateex

So far to add both the date and time with a black background and a text size of 25x25 I do:

-a 1036 -ae +25+25

My full command:

/usr/bin/raspistill -n -t 1000 -w 640 -h 480 -a 1036 -ae +25+25 -o camera.jpg

In case anyone wanted to know :)

1036 = 1024 (black background) + 12 (date and time)

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspistill annotate date

Wed Jun 17, 2015 10:21 pm

Sorry, I really hate documentation so tend to leave it for others having given as much info as possible on the forum threads. Not the greatest situation, but it seemed the best use of my time.
annotateex was covered in viewtopic.php?f=43&t=97929&p=702712#p702710
Was there anything else more specific that you wanted to know?
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

tgwaste
Posts: 41
Joined: Thu Jan 31, 2013 7:15 pm

Re: raspistill annotate date

Wed Jun 17, 2015 11:15 pm

6by9 wrote:Sorry, I really hate documentation so tend to leave it for others having given as much info as possible on the forum threads. Not the greatest situation, but it seemed the best use of my time.
annotateex was covered in viewtopic.php?f=43&t=97929&p=702712#p702710
Was there anything else more specific that you wanted to know?

Nope, that about sums it up. Thanks!

User avatar
dan_in_sd
Posts: 35
Joined: Tue Jul 10, 2012 11:19 pm
Location: San Diego, CA, USA

Re: raspistill annotate date

Mon Jun 22, 2015 12:54 am

This was very helpful. I am, however, seeing an issue with the -dt option. perhaps I am not using it correctly.

This is my command:

Code: Select all

raspistill -n -t 1000 -w 640 -h 480 -a 1036 -ae +25+25 -dt -o /mnt/usbdisk1/stills/camera-test%04d.jpg 
Which works beautifully for annotation, however the resultant filename becomes..
camera-test621174458.jpg
The time part is 174458 which is 5:44:58 PM which is correct.

However, it seems the year is cutoff as well as the first digit of month (i.e. it should be '06' instead of just '6' )

cheers!


UPDATE:

If I change the %04d in the filename to %014d, I get this...
camera-test00000621181644.jpg
Which shows the month, but there is no year at all. Its all zeros.



-dan
San Diego
RPI #1: Model B | Over-clocked | XBMC | RPI #2: Model B+ 512MB | Beautiful metal case from Lukse.LT | RPI #3: PI2 with Camera, 64GB USB Flash and Wi-Fi

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspistill annotate date

Mon Jun 22, 2015 10:04 am

a) This isn't related to the annotation (watermarking) date/time function, so would have been better as a new topic.
b) Go and read the source code https://github.com/raspberrypi/userland ... ll.c#L1807

Code: Select all

                if (state.datetime)
                {
                   time_t rawtime;
                   struct tm *timeinfo;

                   time(&rawtime);
                   timeinfo = localtime(&rawtime);

                   frame = timeinfo->tm_mon+1;
                   frame *= 100;
                   frame += timeinfo->tm_mday;
                   frame *= 100;
                   frame += timeinfo->tm_hour;
                   frame *= 100;
                   frame += timeinfo->tm_min;
                   frame *= 100;
                   frame += timeinfo->tm_sec;
                }
No reference to timeinfo->tm_year, so therefore it won't include the year.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
dan_in_sd
Posts: 35
Joined: Tue Jul 10, 2012 11:19 pm
Location: San Diego, CA, USA

Re: raspistill annotate date

Mon Jun 22, 2015 3:05 pm

6by9,

Thanks for the link.

In that c code, it states that -dt will produce the format YearMonthDayHourMinSec

Its in the help output

Dan
RPI #1: Model B | Over-clocked | XBMC | RPI #2: Model B+ 512MB | Beautiful metal case from Lukse.LT | RPI #3: PI2 with Camera, 64GB USB Flash and Wi-Fi

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspistill annotate date

Mon Jun 22, 2015 3:39 pm

dan_in_sd wrote:In that c code, it states that -dt will produce the format YearMonthDayHourMinSec

Its in the help output
A mismatch by someone then!
Best to create an issue under https://github.com/raspberrypi/userland/issues and someone may take a look. If you felt like it, then you could fix it up and submit a pull request.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20946
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspistill annotate date

Mon Jun 22, 2015 5:35 pm

I don't think that was added by me! Huzzah, something that isn't my fault.

Probably.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5954
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: raspistill annotate date

Mon Jun 22, 2015 8:04 pm

Not you.

Code: Select all

commit 8efa5baddf63166b9d114ce34e1da10685a11ad6
Author: rMamba <[email protected]>
Date:   Tue Feb 17 21:39:31 2015 +0000

    Annotate timelapse images with timestamp or datetime
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
Please don't send PMs asking for support - use the forum.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Camera board”