ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: MichaelG on October 23, 2023, 07:07:29 PM

Title: Bug reading WebP Exif data?
Post by: MichaelG on October 23, 2023, 07:07:29 PM
Hello - I'm using ExifTool in a script to process photos coming from my phone. I recently came across some WebP photos and modified my script to support them. 

It appears from the following output that ExifTool can recognize the DateTimeOriginal data attached to the WebP file in the first command, but in the second command (the rename command) it does not recognize the field and so it renames the webp file using the FileModifyDate instead.

Is there something wrong with the format of the second command or is the data in the webp file somehow corrupted? I downloaded it from the web for testing purposes and attached it in case you need it to diagnose.

Either way, I would have expected both ExifTool commands to work the same way in terms of finding the DateTimeOriginal field.


Thanks in advance for your help - and also thanks for the many hours that go into making Exiftool such a valuable tool!

-Michael



[C:\$$Pictures\PhonePics\FromPhone\Testing\WebP]C:\utilwin\ExifTool.exe -a -G1 -s -time:all *.*
======== example.webp
[System]        FileModifyDate                  : 2023:10:22 12:04:17-04:00
[System]        FileAccessDate                  : 2023:10:22 12:49:13-04:00
[System]        FileCreateDate                  : 2023:10:22 12:04:17-04:00
[IFD0]          ModifyDate                      : 2013:10:21 15:19:01
[ExifIFD]      DateTimeOriginal                : 2013:10:21 15:19:01
[ExifIFD]      CreateDate                      : 2013:10:21 15:19:01
[GPS]          GPSTimeStamp                    : 13:19:01
[GPS]          GPSDateStamp                    : 2013:10:21
[Composite]    GPSDateTime                    : 2013:10:21 13:19:01Z
======== Test1.JPG
[System]        FileModifyDate                  : 2023:10:22 12:16:33-04:00
[System]        FileAccessDate                  : 2023:10:22 12:49:13-04:00
[System]        FileCreateDate                  : 2023:10:22 12:15:19-04:00
[ICC-header]    ProfileDateTime                : 2016:01:01 00:00:00
======== Test2.HEIC
[System]        FileModifyDate                  : 2023:10:22 12:30:37-04:00
[System]        FileAccessDate                  : 2023:10:22 12:49:13-04:00
[System]        FileCreateDate                  : 2023:10:22 12:15:19-04:00
[IFD0]          ModifyDate                      : 2023:10:12 21:04:36
[ExifIFD]      DateTimeOriginal                : 2023:10:12 21:04:36
[ExifIFD]      CreateDate                      : 2023:10:12 21:04:36
[ExifIFD]      OffsetTime                      : -04:00
[ExifIFD]      OffsetTimeOriginal              : -04:00
[ExifIFD]      OffsetTimeDigitized            : -04:00
[ExifIFD]      SubSecTimeOriginal              : 684
[ExifIFD]      SubSecTimeDigitized            : 684
[ICC-header]    ProfileDateTime                : 2022:01:01 00:00:00
[Composite]    SubSecCreateDate                : 2023:10:12 21:04:36.684-04:00
[Composite]    SubSecDateTimeOriginal          : 2023:10:12 21:04:36.684-04:00
[Composite]    SubSecModifyDate                : 2023:10:12 21:04:36-04:00
    3 image files read

[C:\$$Pictures\PhonePics\FromPhone\Testing\WebP]C:\utilwin\ExifTool.exe `-m -v2 -q -ext jpg -ext jpeg -ext png -ext HEIC -ext avi -ext webp -if "$FileName !~ /^^\d{4}-\d{2}-\d{2}-\d{4}-\d{2}.*/"
"-Testname<FileModifyDate" "-Testname<DateTimeOriginal" -d "%Y-%m-%d-%H%M-%S%%+c.%%e"` *.*
======== example.webp
Setting new values from example.webp
Writing File:TestName
'example.webp' --> '2023-10-22-1204-17.webp'
======== Test1.JPG
Setting new values from Test1.JPG
Writing File:TestName
'Test1.JPG' --> '2023-10-22-1216-33.JPG'
======== Test2.HEIC
Setting new values from Test2.HEIC
Writing File:TestName
Writing File:TestName
'Test2.HEIC' --> '2023-10-12-2104-36.HEIC'

[C:\$$Pictures\PhonePics\FromPhone\Testing\WebP]c:\utilwin\exiftool.exe  -ver
12.68

[C:\$$Pictures\PhonePics\FromPhone\Testing\WebP]ver

TCC  25.00.30 x64  Windows 10 [Version 10.0.22621.2428]
Title: Re: Bug reading WebP Exif data?
Post by: StarGeek on October 23, 2023, 08:11:35 PM
Phil will have to take a look, but here's what I figured out.

First, there's a problem with the file.
C:\>exiftool -g1 -a -s -warning -validate Y:\!temp\x\y\example.webp
---- ExifTool ----
Warning                         : [minor] Improper EXIF header
Warning                         : [minor] Odd offset for IFD0 tag 0x011a XResolution
Warning                         : [minor] Odd offset for IFD0 tag 0x011b YResolution
Warning                         : [minor] Odd offset for IFD0 tag 0x0131 Software
Warning                         : [minor] Undefined value for ExifIFD:ExposureIndex
Validate                        : 5 Warnings (all minor)

This command works correctly
C:\exiftool -d "%Y-%m-%d-%H%M-%S%%+c.%%e" "-testname<FileModifyDate" "-testname<DateTimeOriginal" Y:\!temp\x\y\example.webp
Warning: [minor] Improper EXIF header - Y:/!temp/x/y/example.webp
'Y:/!temp/x/y/example.webp' --> 'Y:/!temp/x/y/2013-10-21-1519-01.webp'
    0 image files updated
    1 image files unchanged

But the addition of the -m (-ignoreMinorErrors) option (https://exiftool.org/exiftool_pod.html#m--ignoreMinorErrors) is ignoring the EXIF data, which I'm assuming is because of the Improper EXIF header.
C:\>exiftool -m -d "%Y-%m-%d-%H%M-%S%%+c.%%e" "-testname<FileModifyDate" "-testname<DateTimeOriginal" Y:\!temp\x\y\example.webp
'Y:/!temp/x/y/example.webp' --> 'Y:/!temp/x/y/2023-10-22-1204-17.webp'
    0 image files updated
    1 image files unchanged

Notice how you see the warning in the first command, but it is suppressed with the addition of -m

You can see the same thing listing just the time data, as all the time stamps are in the EXIF group
C:\>exiftool -time:all --system:all -G1 -a -s Y:\!temp\x\y\example.webp
[IFD0]          ModifyDate                      : 2013:10:21 15:19:01
[ExifIFD]       DateTimeOriginal                : 2013:10:21 15:19:01
[ExifIFD]       CreateDate                      : 2013:10:21 15:19:01
[GPS]           GPSTimeStamp                    : 13:19:01
[GPS]           GPSDateStamp                    : 2013:10:21
[Composite]     GPSDateTime                     : 2013:10:21 13:19:01Z

C:\>exiftool -time:all --system:all -G1 -a -s -m Y:\!temp\x\y\example.webp

C:\
Title: Re: Bug reading WebP Exif data?
Post by: Phil Harvey on October 23, 2023, 08:28:14 PM
Thanks for pointing this out.  I don't think this is the behaviour that I intended.  I will update ExifTool 12.69 so the EXIF is read from this file even with the -m option.  Also, I'll patch it to read the also incorrectly written XMP from this file.

- Phil

Edit:  Ah.  I see the file was written by some Google utility.  They should learn to read their own specification.
Title: Re: Bug reading WebP Exif data?
Post by: MichaelG on October 23, 2023, 09:19:41 PM
Thanks for the prompt replies.  I see now where the -m resulted in suppressing the warning. 

Interesting problem a little bit "bad input file", a little bit "operator error", and a little bit "that's not what was intended".

Thanks again!