photostructure / exiftool-vendored.js

Fast, cross-platform Node.js access to ExifTool
https://photostructure.github.io/exiftool-vendored.js/
MIT License
405 stars 37 forks source link

incorrect video create date #151

Closed uhthomas closed 11 months ago

uhthomas commented 11 months ago

Describe the bug

Given a video shot at 14:30:35 GMT +01:00, exiftool-vendored.js with defaultVideosToUTC: false will read:

ExifDateTime {
  year: 2023,
  month: 6,
  day: 11,
  hour: 13,
  minute: 30,
  second: 35,
  millisecond: undefined,
  tzoffsetMinutes: 60,
  rawValue: '2023:06:11 13:30:35',
  zoneName: 'Europe/London'
}

Which is 2023-06-11T13:30:35.000+01:00.

Related to #113. The value from defaultVideosToUTC is 2023-06-11T13:30:35.000Z, correct but obviously missing the timezone data.

To Reproduce

Any video will have this behaviour. Edit: Apple's transcoded MOV omit any timezone offset tags, but may include an offset in the only-used-by-quicktime CreationDate tag.

Expected behavior

It should be 2023-06-11T14:30:35.000+01:00.

Environment (please complete the following information):

mceachen commented 11 months ago

If you could post an example video, so I can take a look, that'd be a big help.

uhthomas commented 11 months ago

https://github.com/photostructure/exiftool-vendored.js/assets/9749173/ec4ec1dc-158d-4d16-b616-13e237989768

mceachen commented 11 months ago

In case you didn't see already, robust timezone extraction is a nightmare, which is why the terrible defaultVideosToUTC hack and this code exist in the first place.

If you can think of simpler and more reliable heuristics for me to apply, I'm all ears.

That said, I think this may be as simple as just adding CreationDate to the extractTzOffsetFromTags array.

uhthomas commented 11 months ago

@mceachen You have my empathy. Thank you for replying so quickly.

That said, I think this may be as simple as just adding CreationDate to the extractTzOffsetFromTags array.

That would be great if so, though I am a bit confused. When defaultVideosToUTC is false, there is a correct timezone but incorrect date, whereas with defaultVideosToUTC as true there is no timezone at all but with the correct UTC date.

mceachen commented 11 months ago

You'll need to set both backfillTimezones and inferTimezoneFromDatestamps to true to see the fix for your file.

uhthomas commented 11 months ago

This is awesome, thank you so much!! Any idea when we can expect a release? @mceachen

mceachen commented 11 months ago

The release was stymied by a regression on windows in node.js v20 (not in this package, but node!)—Unicode characters in filenames cause mkdir to fail.

https://github.com/photostructure/exiftool-vendored.js/actions/runs/5615216938/job/15215019166

Error: File not found - C:/Users/RUNNER~1/AppData/Local/Temp/tmp-6316-4LyVb3QgsXPL/src-😤/😤.jpg at BinaryExtractionTask.parser (src\ExifToolTask.ts:22:19)

I don't have time to look into it right now—could you investigate please?

jrasm91 commented 11 months ago

Is this still an issue? It looks like there was a commit to ignore those broken tests (for now at least).

mceachen commented 11 months ago

Still an issue! This needs to be reported to the node team. Any help would be appreciated.

alex-phillips commented 11 months ago

Since the failing tests are currently skipped in this repo to allow passing builds, could this be addressed after a new release is cut? I'm hoping we can get commit https://github.com/photostructure/exiftool-vendored.js/commit/4b401d1946fb11efe173fcda23444072094c1b05 into a release.