ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: wywh on December 28, 2024, 05:41:04 AM

Title: Supported metadata in .avif
Post by: wywh on December 28, 2024, 05:41:04 AM
Not a big deal but this got me stumped. I have a few .avif images saved from web pages and they all readily accept XMP dates, locations, descriptions etc (a.avif).

But I have just one very similar .avif that accepts also EXIF (b.avif). So should all .avif images do that?

xxd -l 4 -g 1 -u a.avif
00000000: 00 00 00 18                                      ....
xxd -l 4 -g 1 -u b.avif
00000000: 00 00 00 18                                      ....

xxd -l 8 -g 1 -u -s +4 a.avif
00000004: 66 74 79 70 61 76 69 66                          ftypavif
xxd -l 8 -g 1 -u -s +4 b.avif
00000004: 66 74 79 70 61 76 69 66                          ftypavif

exiftool -a -G1 -s -n -fileOrder5 FileName .
======== ./a.avif
[ExifTool]      ExifToolVersion                 : 13.09
[System]        FileName                        : a.avif
[System]        Directory                       : .
[System]        FileSize                        : 56011
[System]        FileModifyDate                  : 2024:12:28 11:52:18+02:00
[System]        FileAccessDate                  : 2024:12:28 11:52:20+02:00
[System]        FileInodeChangeDate             : 2024:12:28 11:52:18+02:00
[System]        FilePermissions                 : 100644
[File]          FileType                        : AVIF
[File]          FileTypeExtension               : AVIF
[File]          MIMEType                        : image/avif
[File]          ImageWidth                      : 960
[File]          ImageHeight                     : 662
[QuickTime]     MajorBrand                      : avif
[QuickTime]     MinorVersion                    : 0.0.0
[QuickTime]     CompatibleBrands                : mif1, miaf
[QuickTime]     HandlerType                     : pict
[QuickTime]     ImageSpatialExtent              : 960 662
[QuickTime]     AV1ConfigurationVersion         : 1
[QuickTime]     ChromaFormat                    : 0
[QuickTime]     ChromaSamplePosition            : 0
[QuickTime]     ImagePixelDepth                 : 10 10 10
[QuickTime]     MediaDataSize                   : 55639
[QuickTime]     MediaDataOffset                 : 372
[Meta]          PrimaryItemReference            : 1
======== ./b.avif
[ExifTool]      ExifToolVersion                 : 13.09
[System]        FileName                        : b.avif
[System]        Directory                       : .
[System]        FileSize                        : 132558
[System]        FileModifyDate                  : 2024:12:28 11:52:18+02:00
[System]        FileAccessDate                  : 2024:12:28 11:52:20+02:00
[System]        FileInodeChangeDate             : 2024:12:28 11:52:18+02:00
[System]        FilePermissions                 : 100644
[File]          FileType                        : AVIF
[File]          FileTypeExtension               : AVIF
[File]          MIMEType                        : image/avif
[File]          ImageWidth                      : 945
[File]          ImageHeight                     : 691
[QuickTime]     MajorBrand                      : avif
[QuickTime]     MinorVersion                    : 0.0.0
[QuickTime]     CompatibleBrands                : mif1, miaf
[QuickTime]     HandlerType                     : pict
[QuickTime]     ImageSpatialExtent              : 945 691
[QuickTime]     AV1ConfigurationVersion         : 1
[QuickTime]     ChromaFormat                    : 0
[QuickTime]     ChromaSamplePosition            : 0
[QuickTime]     ImagePixelDepth                 : 10 10 10
[QuickTime]     MediaDataSize                   : 132186
[QuickTime]     MediaDataOffset                 : 372
[Meta]          PrimaryItemReference            : 1

So surprisingly the following command manages to write EXIF date and location to b.avif:

exiftool -P -overwrite_original '-DateTimeOriginal=2020:06:01 12:00:00' -Composite:GPSPosition='-36.6101, -66.91515' .
    1 directories scanned
    1 image files updated
    1 image files unchanged

exiftool -a -G1 -s -n -fileOrder5 FileName -Time:All -Location:All -XMP:All .
======== ./a.avif
[System]        FileModifyDate                  : 2024:12:28 11:52:18+02:00
[System]        FileAccessDate                  : 2024:12:28 11:52:20+02:00
[System]        FileInodeChangeDate             : 2024:12:28 11:52:18+02:00
======== ./b.avif
[System]        FileModifyDate                  : 2024:12:28 11:52:18+02:00
[System]        FileAccessDate                  : 2024:12:28 11:56:50+02:00
[System]        FileInodeChangeDate             : 2024:12:28 11:56:39+02:00
[ExifIFD]       DateTimeOriginal                : 2020:06:01 12:00:00
[GPS]           GPSVersionID                    : 2 3 0 0
[GPS]           GPSLatitudeRef                  : S
[GPS]           GPSLatitude                     : 36.6101
[GPS]           GPSLongitudeRef                 : W
[GPS]           GPSLongitude                    : 66.91515

This is not a big deal because XMP works OK for both:

exiftool -P -overwrite_original '-XMP:DateTimeOriginal=2020:06:01 12:00:00' '-XMP:GPSLatitude*=-36.6101' '-XMP:GPSLongitude*=-66.91515' '-XMP:GPSAltitude*=119.9' -Description=Description .
    1 directories scanned
    2 image files updated

exiftool -a -G1 -s -n -fileOrder5 FileName -Time:All -Location:All -XMP:All .
======== ./a.avif
[XMP-exif]      DateTimeOriginal                : 2020:06:01 12:00:00
[XMP-exif]      GPSAltitude                     : 119.9
[XMP-exif]      GPSAltitudeRef                  : 0
[XMP-exif]      GPSLatitude                     : -36.6101
[XMP-exif]      GPSLongitude                    : -66.91515
[XMP-x]         XMPToolkit                      : Image::ExifTool 13.09
[XMP-dc]        Description                     : Description
[XMP-exif]      DateTimeOriginal                : 2020:06:01 12:00:00
[XMP-exif]      GPSAltitude                     : 119.9
[XMP-exif]      GPSAltitudeRef                  : 0
[XMP-exif]      GPSLatitude                     : -36.6101
[XMP-exif]      GPSLongitude                    : -66.91515
======== ./b.avif
[XMP-exif]      DateTimeOriginal                : 2020:06:01 12:00:00
[XMP-exif]      GPSAltitude                     : 119.9
[XMP-exif]      GPSAltitudeRef                  : 0
[XMP-exif]      GPSLatitude                     : -36.6101
[XMP-exif]      GPSLongitude                    : -66.91515
[XMP-x]         XMPToolkit                      : Image::ExifTool 13.09
[XMP-dc]        Description                     : Description
[XMP-exif]      DateTimeOriginal                : 2020:06:01 12:00:00
[XMP-exif]      GPSAltitude                     : 119.9
[XMP-exif]      GPSAltitudeRef                  : 0
[XMP-exif]      GPSLatitude                     : -36.6101
[XMP-exif]      GPSLongitude                    : -66.91515

And lastly, after the previous command a weird thing is that even though there should be no metadata remaining to delete, the b.avif always creates _original file indicating exiftool might managed to still delete something again and again:

exiftool -All= .
    1 directories scanned
    2 image files updated

ls -al
-rw-r--r--  1 matti  staff   56011 Dec 28 12:08 a.avif
-rw-r--r--  1 matti  staff   59249 Dec 28 12:06 a.avif_original
-rw-r--r--  1 matti  staff  132558 Dec 28 12:08 b.avif
-rw-r--r--  1 matti  staff  135796 Dec 28 12:06 b.avif_original

rm *_original
ls -al
-rw-r--r--  1 matti  staff   56011 Dec 28 12:08 a.avif
-rw-r--r--  1 matti  staff  132558 Dec 28 12:08 b.avif

exiftool -All= .
    1 directories scanned
    1 image files updated
    1 image files unchanged
ls -al
-rw-r--r--  1 matti  staff   56011 Dec 28 12:08 a.avif
-rw-r--r--  1 matti  staff  132558 Dec 28 12:08 b.avif
-rw-r--r--  1 matti  staff  132558 Dec 28 12:08 b.avif_original

Samples attached avif_samples.zip
- Matti
Title: Re: Supported metadata in .avif
Post by: Phil Harvey on December 28, 2024, 07:20:11 AM
ExifTool should be writing EXIF to both.  Thanks for this report.  I'll look into this.

- Phil
Title: Re: Supported metadata in .avif
Post by: Phil Harvey on December 28, 2024, 03:43:42 PM
I've found the problem.  The issue occurs if there is an existing EXIF header but no TIFF header or EXIF data.

- Phil
Title: Re: Supported metadata in .avif
Post by: Phil Harvey on January 01, 2025, 04:15:08 AM
ExifTool 13.11 should fix this issue.

- Phil
Title: Re: Supported metadata in .avif
Post by: wywh on January 01, 2025, 04:16:46 AM
Quote from: Phil Harvey on December 28, 2024, 03:43:42 PMI've found the problem
Thanks, exiftool 13.11 successfully writes also EXIF to all .avif images.
Title: Re: Supported metadata in .avif
Post by: wywh on January 06, 2025, 04:58:53 AM
Quote from: wywh on January 01, 2025, 04:16:46 AMexiftool 13.11 successfully writes also EXIF to all .avif images
Writing EXIF with exiftool 13.11 also seems to fix those (corrupted?) .avif images so that also older exiftool versions like 13.10 can write EXIF to them.
Title: Re: Supported metadata in .avif
Post by: Phil Harvey on January 06, 2025, 08:58:31 AM
Yes.  The problem was only the partially empty EXIF records, which ExifTool won't write.  I wouldn't call these corrupted.

- Phil