Page 1 of 1

raspistill annotate date

Posted: Tue May 19, 2015 2:42 pm
by anagramster
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.

Re: raspistill annotate date

Posted: Tue May 19, 2015 3:39 pm
by jamesh
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.

Re: raspistill annotate date

Posted: Tue May 19, 2015 3:52 pm
by jamesh
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

Re: raspistill annotate date

Posted: Sat May 23, 2015 6:28 pm
by anagramster
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.

Re: raspistill annotate date

Posted: Wed Jun 17, 2015 8:56 pm
by tgwaste
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)

Re: raspistill annotate date

Posted: Wed Jun 17, 2015 10:21 pm
by 6by9
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?

Re: raspistill annotate date

Posted: Wed Jun 17, 2015 11:15 pm
by tgwaste
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!

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 12:54 am
by dan_in_sd
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

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 10:04 am
by 6by9
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.

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 3:05 pm
by dan_in_sd
6by9,

Thanks for the link.

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

Its in the help output

Dan

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 3:39 pm
by 6by9
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.

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 5:35 pm
by jamesh
I don't think that was added by me! Huzzah, something that isn't my fault.

Probably.

Re: raspistill annotate date

Posted: Mon Jun 22, 2015 8:04 pm
by 6by9
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