[Comment] tag contains timestamp=1566254377. How to convert?

Started by DavidB42, March 07, 2020, 12:06:21 PM

Previous topic - Next topic

DavidB42


[FileType]               GIF
[Type]                    GPhotosAnimation
[FileModifyDate   ]  2019:10:13 21:23:09-04:00
[OriginalDateTime]  missing

I believe that the original image date of a GIF created by Google photos is stored in the [comment] tag.
(thank you, I think, Google)

[Comment]             timestamp=1566254445       (looks to be unix time stamp equivalent to 08/19/2019 @ 10:40pm (UTC))

I need help with command for parsing this comment and storing result into tag [OriginalTmeDate]

Thank you

StarGeek

Try this:
exiftool -d "%s" "-DateTimeOriginal<${comment;m/timestamp=(\d+)/i;$_=$1}" /path/to/files/

This command parses the Comment tag for the string of digits and sets Comment equal to that value.  The -d (dateFormat) option tells exiftool that the date will be formatted as a Unix timestamp.  It will then copy that value into DateTimeOriginal.

C:\>exiftool -g1 -a -s -comment -DateTimeOriginal y:\!temp\Test4.jpg
---- File ----
Comment                         : timestamp=1566254445

C:\>exiftool -P -overwrite_original -d "%s" "-DateTimeOriginal<${comment;m/timestamp=(\d+)/i;$_=$1}" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -DateTimeOriginal y:\!temp\Test4.jpg
---- ExifIFD ----
DateTimeOriginal                : 2019:08:19 22:40:45
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

StarGeek

Ooops, I just noticed that your image was a GIF.  I had assumed that it was a misspelling of DateTimeOriginal.  I haven't seen a OriginalDateTime tag before and it's not documented in the Tag Names section.  It may not be writable.

edit:  Actually is that even exiftool output?
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

DavidB42

Thank you so much - it is perfect

on "OrignalDateTime"  it is my dyslexic construction. 
You are right,  I should have said, DateTimeOriginal.

I don't fully understand the process, but that is because I am a zero on Perl.
I suspect I should change that.

This is the best forum I have used in a long time.
Thanks again