Trying to set a time only tag from the time portion of a date/time tag

Started by agill, March 11, 2014, 01:43:34 AM

Previous topic - Next topic

agill

Not sure if this is possible, but thought I'd ask as I've been trying to work out an exiftool command for it with no success.

The problems is that for one of my cameras, the MakerNotes Time tag (which is time only, no date) is incorrect on all images. The hours are 00, the minutes contain the hours, and the seconds contain the minutes. I suspect an offset problem as it's with the Pentax Optio550 I previously posted offset corrections about here - https://exiftool.org/forum/index.php/topic,5651.0.html

Executing a metadata read shows me that times embedded in other tags are correct, e.g. the EXIF DateTimeOriginal. There seem to be no other time only tags in the metadata for these images, so what I'd like to do is take just the time portion of a date/time tag such as DateTimeOriginal, and use it to overwrite the Time tag.

If anyone has any suggestions I'd be grateful. So far, the only thing I've found that works is to eyeball the metadata, enter the time portion of a date/time tag into a file, then direct exiftool to use the contents of that file to overwrite the Time tag. Certainly that works, but it's tedious as I have many, many images that have the wrong Time tag data and have to look up each one and set up a file for it. It would be a lot easier and more efficient to just set the Time tag from a tag that already has that information, but as noted, the only ones that do are date/time, so somehow I need to exclude the date portion of the tag when doing the overwrite.

Thanks in anticipation of help/ideas to try,
Adrian

StarGeek

ExifTool is smart enough to figure out if the tag is time only and will only copy the time portion from a tag that has date and time.

I found an example Pentax Optio 550 image here on dpreview.com.  It showed the same shift in the pentax:time tag.  I used this command
exiftool "-pentax:time<DateTimeOriginal" -m
to "fix" it and ExifTool showed the corrected time.

But I should say, you might want to give Phil a few example images and see if it's something he can work with.  Because if ExifTool is reading it wrong and you went and fix all these tags, you might be corrupting other data in the MakerNotes.  Then things would get worse if ExifTool gets updated and then all the Pentax:time tags would be wrong again.

* 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).

agill

Many thanks StarGeek for the reply with helpful examples, and the advice to give some images to Phil. I'd been thinking it was the Pentax images that were "wrong", but as you said, it could be that exiftool is reading the metadata incorrectly.

I don't know how to submit to Phil, but will look around in the forum, though if anyone can let me know meanwhile, I'd be grateful.

Thanks again,
Adrian

StarGeek

You can Message him through the forum or email him at philharvey66 at gmail.com.  Or just wait a little while for him to pass though the forums, find this thread and comment :D.
* 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).

agill

Thanks, I sent him a message via the forum, though as you implied, it most likely wouldn't be long before he finds it all anyway! :)

Phil Harvey

Here is a little Terminal session with a sample Optio 550 file.  StarGeek was exactly correct, and his command is the way to do it:

> cp ../pics/PentaxOptio550.jpg a.jpg

> exiftool a.jpg -time:all -G1
[System]        File Modification Date/Time     : 2014:03:15 08:15:48-04:00
[System]        File Access Date/Time           : 2014:03:06 18:51:47-05:00
[System]        File Inode Change Date/Time     : 2014:03:15 08:15:48-04:00
[IFD0]          Modify Date                     : 2003:05:05 20:36:49
[ExifIFD]       Date/Time Original              : 2003:05:05 20:36:49
[ExifIFD]       Create Date                     : 2003:05:05 20:36:49
[Pentax]        Date                            : 2003:05:05
[Pentax]        Time                            : 00:20:36
[Pentax]        World Time Location             : Hometown
[Pentax]        Hometown City                   : New York
[Pentax]        Destination City                : New York
[Pentax]        Hometown DST                    : No
[Pentax]        Destination DST                 : No

> exiftool a.jpg "-pentax:time<datetimeoriginal"
Warning: Invalid PrintIM header - a.jpg
Warning: [minor] Ignored 4 invalid entries from MakerNotes - a.jpg
Error: [minor] MakerNotes offsets may be incorrect (fix or ignore?) - a.jpg
    0 image files updated
    1 files weren't updated due to errors

> exiftool a.jpg -pentax:time'<datetimeoriginal' -m
Warning: Invalid PrintIM header - a.jpg
Warning: MakerNotes offsets may be incorrect (ignored) - a.jpg
    1 image files updated

> exiftool a.jpg -time:all -G1
[System]        File Modification Date/Time     : 2014:03:15 08:16:13-04:00
[System]        File Access Date/Time           : 2014:03:15 08:16:13-04:00
[System]        File Inode Change Date/Time     : 2014:03:15 08:16:13-04:00
[IFD0]          Modify Date                     : 2003:05:05 20:36:49
[ExifIFD]       Date/Time Original              : 2003:05:05 20:36:49
[ExifIFD]       Create Date                     : 2003:05:05 20:36:49
[Pentax]        Date                            : 2003:05:05
[Pentax]        Time                            : 20:36:49
[Pentax]        World Time Location             : Hometown
[Pentax]        Hometown City                   : New York
[Pentax]        Destination City                : New York
[Pentax]        Hometown DST                    : No
[Pentax]        Destination DST                 : No


The problem is that the Optio 550 maker notes are particularly buggy, and it also writes the Time tag incorrectly when compared to other models.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

agill

Thanks for responding Phil, and for taking the time (no pun intended :) ) to provide a specific Optio550 example.

The - [Pentax]        Time                            : 00:20:36 - you show is exactly what I get when looking at that tag in any original image from my Optiio550 - the hours zero, actual hours in the minutes, and minutes in the seconds, with the actual seconds lost.

And yes, trying StarGeek's command format definitely worked for the tests I did with my images so my thanks to StarGeek for that help.

From what you wrote the problem is NOT with exiftool, rather the Optio550 images incorrectly specifying the - [Pentax]        Time - tag. Looking at all the metadata from my images, what I've observed backs that up, as when I make the correction, no other parts of the metadata, e.g. the rest of the MakerNotes, seem to  be affected in any way - checking against before and after metadata reads.

In that case I'd say it's "case closed", the Optio550 images have incorrect - [Pentax]        Time - tags, and I can use StarGeek's command format to correct them all - great! Which also means you won't be needing any examples of Optio550 images from me, as you already know about this and have your own. If that changes in any way, please just let me know.

Many thanks to you both for helping with this,
Adrian
P.S. for what it's worth, I think that part of the strength of this tool is this forum, as sometimes new folks like me make mistakes with/don't know how to use the tool, despite reading the documentation. To be able to post a request for help, and have folks come back so promptly with detailed explanations makes the whole thing work on a higher level.

Phil Harvey

Just out of interest I tried all my Pentax samples, and this problem affects 6 models: Optio 30/33WR/43WR/450/550/555

> exiftool -datetimeoriginal -pentax:time -model -T -if '$pentax:time' -ext jpg ../pics/Pentax*
2004:01:20 13:46:59 13:46:59 PENTAX *ist D
2005:06:05 10:41:09 10:41:09 PENTAX *ist DL
2006:01:12 12:02:20 12:02:20 PENTAX *ist DL2
2005:06:22 16:23:02 16:23:02 PENTAX *ist DS
2005:11:29 17:17:32 17:17:32 PENTAX *ist DS2
2010:01:05 22:49:32 22:49:32 PENTAX 645D
2012:03:21 15:33:50 15:33:50 PENTAX K-01
2013:09:11 09:56:42 09:56:42 PENTAX K-3
2012:07:09 11:51:14 11:51:14 PENTAX K-30
2010:11:03 17:14:46 17:14:46 PENTAX K-5
2013:06:20 09:47:37 09:47:37 PENTAX K-50
2013:06:12 17:00:20 17:00:20 PENTAX K-500
2012:10:17 13:49:19 13:49:19 PENTAX K-5 II
2012:10:27 13:08:49 13:08:49 PENTAX K-5 II s
2009:04:22 07:12:45 07:12:45 PENTAX K-7
2008:11:09 11:17:14 11:17:14 PENTAX K-m
2010:09:08 10:34:22 10:34:22 PENTAX K-r
2009:08:25 10:08:28 10:08:28 PENTAX K-x
2006:04:27 05:35:56 05:35:56 PENTAX K100D
2007:09:16 20:25:36 20:25:36 PENTAX K100D Super
2006:09:02 17:37:30 17:37:30 PENTAX K10D
2006:01:01 00:03:59 00:03:59 PENTAX K110D
2009:01:14 11:28:38 11:28:38 PENTAX K2000
2007:11:13 07:08:54 07:08:54 PENTAX K200D
2007:10:11 12:33:12 12:33:12 PENTAX K20D
2013:02:13 15:34:15 15:34:15 PENTAX MX-1
2002:05:07 15:04:25 15:04:25 PENTAX Optio 230
2005:01:26 14:22:16 00:14:22 PENTAX Optio 30
2002:11:08 16:01:53 16:01:53 PENTAX Optio 330GS
2003:05:12 15:28:38 15:28:38 PENTAX Optio 33L
2004:12:31 14:50:38 14:50:36 PENTAX Optio 33LF
2003:12:22 16:40:07 00:16:40 PENTAX Optio 33WR
2004:06:04 14:57:23 00:14:57 PENTAX Optio 43WR
2003:01:01 00:48:56 00:00:48 PENTAX Optio 450
2003:05:05 20:36:49 00:20:36 PENTAX Optio 550
2003:10:13 15:08:00 00:15:08 PENTAX Optio 555
2004:11:04 12:18:06 12:18:06 PENTAX Optio 750Z
2006:01:01 23:39:54 23:39:52 PENTAX Optio A10
2006:08:24 11:45:47 11:45:45 PENTAX Optio A20
2007:01:28 08:49:35 08:49:33 PENTAX Optio A30
2007:09:18 11:31:35 11:31:33 PENTAX Optio A40
2007:07:02 11:27:02 11:27:00 PENTAX Optio E40
2008:01:16 12:03:57 12:03:57 PENTAX Optio E50
2008:09:15 13:47:00 13:47:00 PENTAX Optio E60
2009:01:10 17:31:31 17:31:31 PENTAX Optio E70
2010:06:01 11:36:01 11:36:01 PENTAX Optio E80
2010:05:20 19:45:35 19:45:35 PENTAX Optio E90
2010:04:08 10:54:09 10:54:09 PENTAX Optio H90
2010:02:20 14:51:52 14:51:52 PENTAX Optio I-10
2006:12:20 13:32:29 13:32:27 PENTAX Optio L20
2009:04:05 10:44:49 10:44:49 PENTAX Optio L30
2010:05:22 17:59:01 17:59:01 PENTAX Optio L36
2010:01:01 14:23:18 14:23:18 PENTAX Optio L40
2009:04:12 16:28:38 16:28:38 PENTAX Optio L50
2010:11:26 18:39:42 18:39:42 PENTAX Optio L70
2011:06:07 13:09:36 13:09:36 PENTAX Optio LS1000
2012:01:04 20:27:24 20:27:23 PENTAX Optio LS465
2006:01:27 14:48:18 14:48:18 PENTAX Optio M10
2006:07:31 10:38:58 10:38:58 PENTAX Optio M20
2007:02:08 15:13:32 15:13:32 PENTAX Optio M30
2007:07:02 11:48:09 11:48:09 PENTAX Optio M40
2008:01:17 10:09:00 10:09:00 PENTAX Optio M50
2008:07:25 16:58:09 16:58:09 PENTAX Optio M60
2010:11:28 21:42:18 21:42:18 PENTAX Optio M90
2004:07:22 09:35:54 09:35:54 PENTAX Optio MX
2005:07:05 13:36:40 13:36:40 PENTAX Optio MX4
2009:02:16 12:04:28 12:04:28 PENTAX Optio P70
2009:09:26 12:08:23 12:08:23 PENTAX Optio P80
2010:11:18 12:01:14 12:01:14 PENTAX Optio RS1000
2011:05:02 14:20:18 14:20:18 PENTAX Optio RS1500
2010:10:26 11:00:55 11:00:55 PENTAX Optio RZ10
2011:12:07 11:00:57 11:00:57 PENTAX Optio RZ18
2003:03:06 13:09:25 13:09:25 PENTAX Optio S
2011:01:05 10:46:46 10:46:46 PENTAX Optio S1
2007:07:26 17:35:56 17:35:54 PENTAX Optio S10
2008:11:07 15:50:04 15:50:03 PENTAX Optio S12
2004:11:08 12:31:51 12:31:51 PENTAX Optio S30
2003:10:02 15:04:48 15:04:48 PENTAX Optio S4
2006:01:28 09:42:47 09:42:47 PENTAX Optio S40
2005:07:07 14:30:19 14:30:18 PENTAX Optio S45
2004:04:19 14:58:15 14:58:15 PENTAX Optio S4i
2005:02:26 23:50:42 23:50:41 PENTAX Optio S50
2005:07:15 11:02:44 11:02:43 PENTAX Optio S55
2004:11:15 18:30:51 18:30:51 PENTAX Optio S5i
2005:02:06 14:57:22 14:57:22 PENTAX Optio S5n
2005:05:10 11:11:23 11:11:23 PENTAX Optio S5z
2005:01:14 05:12:22 05:12:20 PENTAX Optio S6
2005:11:06 17:27:09 17:27:08 PENTAX Optio S60
2006:07:13 15:27:36 15:27:34 PENTAX Optio S7
2005:04:24 11:52:32 11:52:32 PENTAX Optio SV
2005:05:09 14:45:47 14:45:47 PENTAX Optio SVi
2004:09:19 01:43:04 01:43:04 PENTAX Optio S
2007:02:25 14:55:52 14:55:52 PENTAX Optio T30
2007:09:21 12:01:49 12:01:49 PENTAX Optio V10
2008:05:22 12:33:39 12:33:39 PENTAX Optio V20
2012:04:12 17:33:46 17:33:46 PENTAX Optio VS20
2006:01:27 10:04:35 10:04:35 PENTAX Optio W10
2006:07:13 13:13:38 13:13:38 PENTAX Optio W20
2007:01:25 09:42:58 09:42:58 PENTAX Optio W30
2008:06:25 12:23:01 12:23:01 PENTAX Optio W60
2009:07:14 00:18:23 00:18:23 PENTAX Optio W80
2010:04:11 16:22:59 16:22:59 PENTAX Optio W90
2011:01:02 20:38:16 20:38:16 PENTAX Optio WG-1 GPS
2012:03:18 13:56:34 13:56:34 PENTAX Optio WG-2 GPS
2005:05:23 12:26:12 12:26:12 PENTAX Optio WP
2006:08:16 02:41:36 02:41:36 PENTAX Optio WPi
2009:09:10 13:03:30 13:03:30 PENTAX Optio WS80
2005:02:06 11:17:04 11:17:04 PENTAX Optio X
2007:09:07 16:08:36 16:08:36 PENTAX Optio Z10
2011:08:19 11:04:01 11:04:01 PENTAX Q
2012:11:14 14:19:14 14:19:14 PENTAX Q10
2013:06:30 19:27:09 19:27:09 PENTAX Q7
2013:05:14 13:32:05 13:32:05 PENTAX WG-10
2013:01:01 00:00:27 00:00:27 PENTAX WG-3
2013:06:07 12:46:59 12:46:59 PENTAX WG-3 GPS
2012:07:22 11:10:41 11:10:41 PENTAX X-5
2009:03:11 15:14:32 15:14:32 PENTAX X70
2010:05:10 13:02:08 13:02:08 PENTAX X90


One could argue that ExifTool is decoding the time incorrectly for these 6 models.  And often I would agree and add special code to handle these models differently, but in this particular case there are a number of other formatting errors in the maker notes of these models (see my Maker Note Idiosyncracies page) which convinced me to chalk it up to a Pentax bug rather than a model-specific "feature".

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

agill

The more I use exiftool, the more impressed I become with the vast amount of comprehensive research that's gone into making it work! Where you find time to do it all I've no idea, but all credit to you!

Thanks,
Adrian