How to append Timezone to DateTimeOriginal

Started by Archive, May 12, 2010, 08:54:11 AM

Previous topic - Next topic

Archive

[Originally posted by gps on 2007-10-22 15:08:29-07]

1. How do I automate the appending of "-05:00" for a directory of 100 files? Its difficult to issue this command for 7000 files individually "exiftool -datetimeoriginal='2000:01:02 03:04:04-05:00' -n image.jpg"

2. The  "-GPSTimeStamp+=5" doesn't shift the value for me. Its giving me errors like

"Warning: Can't handle ValueConv for GPSTimeStamp in ApplyShift() when shifting GPSTimeStamp - DSC00456.JPG "

---------------------

Background

---------------------

I use the following  command to copy DateTimeOriginal to GPSTimeStamp

Code:
exiftool -overwrite_original "-GPSTimeStamp < $DateTimeOriginal" *.jpg

then I issue the following command for shifting the GPSTimeStamp to represent UTC

Code:
exiftool -overwrite_original -GPSTimeStamp+=5 *.jpg

then I get the following errors:

Warning: Can't handle ValueConv for GPSTimeStamp in ApplyShift() when shifting GPSTimeStamp - DSC00456.JPG

Warning: Can't handle ValueConv for GPSTimeStamp in ApplyShift() when shifting GPSTimeStamp - DSC00457.JPG

Also, the GPSTimeStamp doesn't have the UTC at the end of it. And if DateTimeOriginal is 09:04:03 So, my questions again.

1. How to append "-05:00"  to DateTimeOriginal?

2. How to shift the GPSTimeStamp?

3. Any idea, if shifting the GPSTimeStamp also changes GPSDateStamp, if the shift value takes it to the next/previous day?

Thanks.

Archive

[Originally posted by cocker68 on 2007-10-22 15:35:58-07]

Compare this thread.

Stating a timzone is not in EXIF's specification.

But Your approach to this subject, is equal to mine:

- store UTC in GPSDateStamp and GPSTimeStamp

- store local time in DateTimeOriginal

- Cocker :wq

Archive

[Originally posted by exiftool on 2007-10-22 16:20:01-07]

Thanks for pointing this out.  The shifting for the GPSTimeStamp should work.
I will fix this for the next release.

The GPSTimeStamp is UTC according to the specification, but it isn't a string
value so there is no way to add "UTC" or "Z" or "+00:00" after it to specify
the time zone.  It is just understood that it is UTC.

To append "-05:00" to datetimeoriginal in an automated fashion, you could
do this:

Code:
exiftool '-datetimeoriginal<${datetimeoriginal}-05:00' DIR

(Note: Use double quotes instead of single quotes if you are running in a
Windows shell.)

Unfortunately, shifting individual time values does not currently affect the
corresponding date value if the tags are separate (as with
GPSDateStamp/GPSTimeStamp).

- Phil

Archive

[Originally posted by gps on 2007-10-22 17:21:32-07]

Cocker: Thanks. My approach is derived from yours. I stumbled upon yours. The problem is that I also do GPS Tagging and I wonder if it will affect my subsequent GPS tagging. Or probably I could change the GPSTime/DateStamp values after geotagging.

Phil: Thanks again, you are very patient. However the command you gave me as below, didn't work

Code:
exiftool '-datetimeoriginal<${datetimeoriginal}-05:00' DIR

I get no errors, but just the message that "27 image files updated". But when I use exiftool to view the exif tags, nothing is different.

My suggestions (I use exiftool ver 6.99 under windows):

1. GPSTimeStamp shifting is not working properly with the above version. Even if it works, shifting of GPSTimeStamp doesn't affect the GPSDateStamp like DateTimeOriginal.

 Example: 2007:01:20 02:04:03 doesn't shift to 2007:01:19 21:04:03 for GPSDateStamp and GPSTimeStamp

 the best way to address both the issues for now is:

Code:
exiftool -DateTimeOriginal+=5 DIR
exiftool "-GPSTimeStamp < $DateTimeOriginal" DIR
exiftool "-GPSDateStamp < $DateTimeOriginal" DIR
exiftool -DateTimeOriginal-=5 DIR

ie, first shift the DateTimeOriginal, copy the shifted time to GPSTimeStamp/GPSDateStamp and shift back the DateTimeOriginal. Assuming that the original time is 5hrs behind UTC. I don't like multiple writes personally, but I am looking for any other suggestions.

Also, I have read that the exif standard is not maintained anymore, so probably its not actively being pursued. I am starting to tag my pictures, which ones do you suggest me to follow EXIF/IPTC/XMP?

Other observations:

With only GPSDateStamp or GPSTimeStamp, Picasa puts an icon on the image, as if it has been geotagged, whereas they don't have the long/lat coordinates yet. This is misleading in Picasa.

Irfanview doesn't show GPSDateStamp.

Thanks.

Archive

[Originally posted by exiftool on 2007-10-22 17:59:46-07]

You wrote:

Code:
>I get no errors, but just the message that "27 image files updated".
> But when I use exiftool to view the exif tags, nothing is different.

Ooops.  My mistake.  I forgot to add the -n option.  Without that,
exiftool reformats the date/time value to standard EXIF, removing the
timezone.

Rather than rewriting the file 4 times, you could create a user-defined tag with
the desired time shift.  ie)

Code:
%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        ShiftedDateTime => {
            Require => {
                0 => 'DateTimeOriginal',
            },
            ValueConv => q{
                require 'Image/ExifTool/Shift.pl';
                Image::ExifTool::ShiftTime($val[0], '5', +1);
                return $val[0];
            },
            PrintConv => '$self->ConvertDateTime($val)',
        },
    },
);

Then use this command line:

Code:
exiftool "-gpstimestamp<shifteddatetime" "-gpsdatestamp<shifteddatetime" DIR

But it sounds like using the GPSDate/TimeStamp isn't ideal for you.  Perhaps
you should go with the non-standard EXIF DateTimeOriginal instead.

- Phil

Archive

[Originally posted by gps on 2007-10-22 19:59:02-07]

Phil,
      Thanks. What scripting language is this? I am on Windows, and let me know how to get this working. I know Perl and am versed with other languages.

Thanks.

Archive

[Originally posted by gps on 2007-10-22 22:03:40-07]

Phil,
    I am inclining towards using non-Exif standard of using +hh:mm at the end of DateTimeOriginal. Are there any softwares which had problems with doing so?

Thanks.

Archive

[Originally posted by exiftool on 2007-10-23 11:30:07-07]

This is Perl.  See the configuration
documentation
for details on how to create user-defined tags.

I am not aware of any software that has problems with a timezone on the EXIF
date/time string, but the possibility exists because it is not the standard.  Most
software simply displays the string and doesn't care about the content.

- Phil

Archive

[Originally posted by gps on 2007-10-26 15:09:13-07]

I saw that exiftool 7.00 has the GPSTimeStamp shifting fixed. However, it would be a convenient feature if I could shift the GPSDateStamp simultaneously.

Thanks.

Archive

[Originally posted by exiftool on 2007-10-26 15:28:31-07]

This can be done via user-defined composite tags as described
above.  Just require "GPSDateTime" instead of  "DateTimeOriginal"
in the ShiftedDateTime definition above and you'll have a technique
to apply a fixed date/time offset that you can write to the
GPSTimeStamp and GPSDateStamp tags.

Unfortunately this is the best I can do for now, because
implementing a proper time shift operation on a pair of
independent tags is not easy to do in a general way.

- Phil

Archive

[Originally posted by gps on 2007-10-26 17:56:54-07]

Thanks. I tried the PERL version of it and included the above code, but for some reason it didn't work. I could send the error messages later, but I got messages which basically meant that "shiftedDateTime" is not a valid tag. I could revisit at a later time and work on it.

I didn't give much effort on that, and wanted to see a command line tool, instead of my own modifications. The reasons are 3 fold

a.My laziness to work on it more, even though you have gone lengths to explain how to do

b.I am showing exiftool to my friends who have similar problems, but don't now coding at all. And a command line tool to do a combined Date and Time shift for GPS tags will be a hassle-free way.

c.Appending DateTimeOriginal with [+hh:mm] might affect the usage of the file in softwares in future, and a GPS stamp method seems to just do what I need.

Right now, I am using the 3 step method I mentioned

Code:
exiftool -DateTimeOriginal+=5 DIR
exiftool "-GPSTimeStamp < $DateTimeOriginal" "-GPSDateStamp < $DateTimeOriginal" DIR
exiftool -DateTimeOriginal-=5 DIR

Each write above takes about 2 minutes for about 300-400 files. And all the 3 commands take about 4 minutes roughly for 300-400 files.  And I have a few 10s of thousands of files. So, doing this faster (probably 1 single command) is ideal.

The above works perfectly, however its "3 writes". The alternative of which is using user-defined tags as mentioned by you earlier (which I probably should work on more).

Also, I wonder, why combining the 3 commands into one, as below, didn't work. Any idea?

Code:
exiftool "-DateTimeOriginal+=5"  "-GPSTimeStamp < $DateTimeOriginal" "-GPSDateStamp < $DateTimeOriginal" "-DateTimeOriginal-=5" DIR

Archive

[Originally posted by gps on 2007-10-26 18:41:49-07]

Ok. 3 commnands, as explained above involves 3 writes. And a single command line doesn't work (it does either the first dateshift or the last dateshift, based on how you use the quotes). But, I have experimented and got it down to two writes

Code:
exiftool "-DateTimeOriginal+=5"   DIR
exiftool "-GPSTimeStamp<$DateTimeOriginal -GPSDateStamp<$DateTimeOriginal" "-DateTimeOriginal-=5" DIR

It appears that, if I use two datetimeshifts in the same command line only one is done (based on the way the quotes are used.

Ex: Below examples have variations of the commands with and without quotes (on windows)

Code:
exiftool "-DateTimeOriginal+=5"   "-DateTimeOriginal-=5" DIR

In the above, the 2nd dateshift is executed, and not the first.

Code:
exiftool "-DateTimeOriginal+=5   -DateTimeOriginal-=5" DIR

In the above, the 1st dateshift is executed, and not the second.

Code:
exiftool -DateTimeOriginal+=5   -DateTimeOriginal-=5 DIR

In the above, the 2nd dateshift is executed, and not the first.

So, there is some problem in doing two dateshifts on the same tag.

Archive

[Originally posted by exiftool on 2007-10-26 21:57:03-07]

You may write only one value per tag (except for List-type tags,
which support multiple values).  So only one date shift may be
applied to DateTimeOriginal per command line.  Subsequent
assignments override previous ones.

User defined tags are not difficult.  Just cut and paste the code I
gave you into a file called ".ExifTool_config" and place it either in
your home directory, or the directory where exiftool.exe lives.
From your times it sounds like this will save you at least an hour
of processing time, so if it take you less than an hour to get it
working you're further ahead. Wink

- Phil