Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
922 stars 278 forks source link

Dates are misinterpreted as XmpText #2899

Closed kartonrad closed 8 months ago

kartonrad commented 8 months ago

Describe the bug

Exiv2 outputs a number for all XMP fields which should normally contain Date Strings, according to Adobes Specification.

> exiv2 -p at --key Xmp.video.MediaCreateDate print D:\Kamera\MP_ROOT\100ANV01\MAH00696.MP4
Xmp.video.MediaCreateDate                    XmpText    10  3593683864

I am going to be honest, maybe i am just to silly to properly parse this value, but the number doesn't seem to be a unix timestamp. I am calling exiv2 as part of a rust program i am writing to organize my media files. For videos and audio, exiv2 isn't as reliable with timestamps.

To Reproduce

  1. Download the current Release "v0.28.1"
  2. Download this file, copyright by me, taken on my Sony Digital Camera a few years back, permission is granted for it to be distributed under the project's license
  3. Run the exiv2 command to print XMP fields, and see that the MediaCreateDate Field (and others) are set to some number, that doesnt look like a Date String (e.g 2017-11-16T13:31:04Z ), isn't the correct Unix Timestamp.
  4. Open Windows Properties and run exiftool, to see that the property is interpreted differently by other programs
> exiv2 -p at --key Xmp.video.MediaCreateDate print D:\Kamera\MP_ROOT\100ANV01\MAH00696.MP4
Xmp.video.MediaCreateDate                    XmpText    10  3593683864
exiftool D:\Kamera\MP_ROOT\100ANV01\MAH00696.MP4
ExifTool Version Number         : 12.67
File Name                       : MAH00696.MP4

File Modification Date/Time     : 2017:11:16 13:34:20+01:00
File Access Date/Time           : 2023:02:11 02:02:18+01:00
File Creation Date/Time         : 2023:02:11 02:02:19+01:00

Create Date                     : 2017:11:16 13:31:04
Modify Date                     : 2017:11:16 13:34:18

Track Create Date               : 2017:11:16 13:31:04
Track Modify Date               : 2017:11:16 13:34:18
Track ID                        : 1

Media Header Version            : 0
Media Create Date               : 2017:11:16 13:31:04
Media Modify Date               : 2017:11:16 13:34:18
Media Time Scale                : 48000
Media Duration                  : 0:03:14
Media Language Code             : und

Expected behavior

I expect an output like

Xmp.video.MediaCreateDate                    Date   2017-11-16 13:31:04

Although WIndows "Properties" show a different date: 2017-01-28 16:49

Desktop (please complete the following information):

kmilos commented 8 months ago

TBH, I couldn't find an authoritative source for this Xmp.video "XMP Extended Video schema".

The exiv2 code says this:

https://github.com/Exiv2/exiv2/blob/cac362c7285237f55bc45ee3fe1effba1f7b741a/src/properties.cpp#L3682-L3684

If this is the correct number in seconds, then I don't think it is a bug, unless the actual schema specification says this should be of "date" type.

kartonrad commented 8 months ago

Huh! - i guess i just didn't read far enough into it - i couldn't find anything for the exact property name either - which is definetly wierd, but i brushed it off. And pretended that "Created" was close enough

If the Timestamp is since January 1904, that actually makes sense!

If i add -2082848400 to the timestamp before parsing it (as a unix timestamp) the value is completely accurate, and the same one as is output by other commands! Thank you so much for your help... and sorry that i filed this as a bug, i didn't know better

In the future i'll know to look in properties.cpp