Please support creation and modification of Quicktime's GPSCoordinates tag

Started by Tempest Character, April 25, 2019, 05:56:20 PM

Previous topic - Next topic

Tempest Character

It is so annoying that Apple's Photos application reads the GPSLatitude and GPSLongitude tags from JPEGs, but not MOVs (it's bad enough that it won't read the DateTimeOriginal tag from AVCHD/MTS files -- making the MTS file the Photos copying date, but at least I have a workflow that losslessly remuxes MTS files to MOV files).  Thus, if I could only create and write to the GPSCoordinates tag to the MOV file, I can use my geotagging data to establish the movie's location as well, that would show up in Photos!

I see people over the years have touched on this subject, and I get the sense that it was something Mr. Harvey meant to do, so if my little vote helps, I'd be grateful! 

Thanks!

Phil Harvey

...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 ($).

Tempest Character

Just tried it, and seems to work great.   ;D
Now with the following that will stuff the GPSLatitude and GPSLongitude fields into GPSCoordinates:

exiftool -GPSCoordinates<"$GPSLatitude, $GPSLongitude"

and we're off to the races!
Much thanks!

Phil Harvey

...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 ($).

Tempest Character

Phil -- again thanks for your help and patience, but the Apple Mac OS X Photos app still seems to be looking for something before accepting the *.mov files GPS data and presenting same.  I cannot figure out what that may be.  I thought it could be the GPSAltitude having to be concatenated onto the GPSCoordinates tag, but no such luck (since it only presents location in 2 dimensions, I should have suspected as such). 

Looking at just the tags with "GPS" in them (i.e., exiftool "-*GPS*" a.mov) in a movie I tagged as we discussed here, I get:

QuoteGPS Altitude Ref                : Above Sea Level
GPS Coordinates                 : 40 deg 25' 1.27" N, 3 deg 42' 12.77" W, 667 m Above Sea Level
GPS Altitude                    : 667 m Above Sea Level
GPS Latitude                    : 40 deg 25' 1.27" N
GPS Latitude Ref                : North
GPS Longitude                   : 3 deg 42' 12.77" W
GPS Longitude Ref               : West
GPS Position                    : 40 deg 25' 1.27" N, 3 deg 42' 12.77" W

while I compare it with a .mov file generated by my iPhone (that Apple Photos does present GPS coordinates), I get:

QuoteGPS Coordinates                 : 30 deg 19' 20.64" N, 35 deg 27' 6.12" E, 995.625 m Above Sea Level
GPS Altitude                    : 995.625 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : 30 deg 19' 20.64" N
GPS Longitude                   : 35 deg 27' 6.12" E
GPS Position                    : 30 deg 19' 20.64" N, 35 deg 27' 6.12" E

So, the tags appear in different orders and the iPhone mov lacks the GPS Latitude Ref and GPS Longitude Ref tags, and the GPS Altitude tag does not have "Above Sea Level" appended.  If that were the reason, I don't think I would be able to manipulate the tags to come out exactly the same.  If on the other hand, there is tag other than one with "GPS" in it that is cause Apple Photos to avoid reading the GPS data, I wouldn't have a clue what tag that could be.

Will understand perfectly if you shrug your shoulders and say you are not an Apple developer and thus do not know it's internal architecture.

Cheers,

Ariel

StarGeek

What is the output of
exiftool -gps* -a -g1 a.mov

This will help figure out where the tags are located and if there are duplicate entries.
* 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).

Tempest Character

StarGeek -- again thanks for your help.  You may be onto something regarding where the tags are located.

The mov I tagged gave the following result:

Quote---- XMP-exif ----
GPS Altitude                    : 7 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : 38 deg 20' 27.84" N
GPS Longitude                   : 0 deg 29' 10.87" W
---- UserData ----
GPS Coordinates                 : 38 deg 20' 27.84" N, 0 deg 29' 10.86" E, 7 m Above Sea Level
---- Composite ----
GPS Altitude                    : 7 m Above Sea Level
GPS Altitude                    : 7 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : 38 deg 20' 27.84" N
GPS Latitude Ref                : North
GPS Longitude                   : 0 deg 29' 10.86" E
GPS Longitude Ref               : West
GPS Position                    : 38 deg 20' 27.84" N, 0 deg 29' 10.86" E

while the iPhone mov gave this result:

Quote---- Keys ----
GPS Coordinates                 : 30 deg 19' 20.64" N, 35 deg 27' 6.12" E, 995.625 m Above Sea Level
---- Composite ----
GPS Altitude                    : 995.625 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : 30 deg 19' 20.64" N
GPS Longitude                   : 35 deg 27' 6.12" E
GPS Position                    : 30 deg 19' 20.64" N, 35 deg 27' 6.12" E

Definitely in different places!  Should I thus assume the following is insufficient to get the tag in the right place:

Quoteexiftool -GPSCoordinates<"$GPSLatitude, $GPSLongitude, $GPSAltitude" a.mov

and if so, what else needs to be added?

Thanks again.

StarGeek

The Composite tags are tags exiftool creates from other tags in the file (in this case, GPSCoordinates), so you can dismiss those.  The XMP tags are probably not read.

But the GPSCoordinates tag is in different places.  Try
exiftool "-Keys:GPSCoordinates<GPSCoordinates"
or in the case of your original command
exiftool "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude"



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

Tempest Character

StarGreek -- appreciate your persistence here.  I tried your suggestion, but I am wondering if Phil Harvey's recently-added support for GPSCoordinates does not go that far.  I put on the verbose flag to see what happened:

Quoteexiftool "-Keys:GPSCoordinates<GPSCoordinates" -v1 00330.mov
======== 00330.mov
Setting new values from 00330.mov
Rewriting 00330.mov...
  FileType = MOV
  FileTypeExtension = MOV
  MIMEType = video/quicktime
  Editing tags in: Keys
  Rewriting Movie
  Rewriting MovieHeader
  Rewriting Track
  Rewriting TrackHeader
  Rewriting Media
  Rewriting MediaHeader
  Rewriting MediaInfo
  Rewriting DataInfo
  Rewriting DataRef
  Rewriting SampleTable
  Rewriting Track
  Rewriting TrackHeader
  Rewriting Media
  Rewriting MediaHeader
  Rewriting MediaInfo
  Rewriting DataInfo
  Rewriting DataRef
  Rewriting SampleTable
  Rewriting UserData
  Rewriting Meta
  Rewriting ItemList
  Rewriting XMP
Nothing changed in 00330.mov
    0 image files updated
    1 image files unchanged

Is it because there is no "Keys" section created to which exiftool can write GPSCoordinates?

Thanks!

StarGeek

I haven't really played with the new features regarding video files yet, so this was just a guess.  You may have to wait for a response from Phil as to the difference between Keys and UserData tags.
* 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).

Phil Harvey

Keys tags are harder to write, but this is next on my list of features to add.  Apple does seem to prefer this location.

- 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 ($).

Tempest Character

Well, I sure appreciate your continued dedication to this task!  The weather should be getting nicer in Kingston, make sure you enjoy it...  And I say that as a former Torontonian!

Phil Harvey

Wow.  This is turning out to be a lot more work that I had hoped.  I've put in about 30 hours of time so far adding this feature, and am at the point where everything is in place and just needs to be tested thoroughly.  Testing will take some time, but it is looking good so far.

- 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 ($).

Tempest Character

Oh my!  I can only hope that this has taught you things that have broader applicability to enhance ExifTool!  Best wishes...!

Phil Harvey

I have just released ExifTool 11.45.  The testing had been going very well, but I had wanted to do another day or two of testing before I made the release.  However, I released this version early to roll out an emergency patch to fix a compatibility issue with CR3 editing. 

I'll continue to test this for the next couple of days, and make another quick release if I find any problems.  So please let me know if you find anything that doesn't work the way you expect.

- 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 ($).

Phil Harvey

I've now completed a more extensive round of testing, and have found a number of minor bugs, so you may want to update to ExifTool 11.49 (just released).  None of the bugs affect MOV/MP4 file integrity -- they are all related to trying to get ExifTool to write the expected tags, and many of the problems were related to the alternate-language support.

- 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 ($).

Tempest Character

Phil (and StarGeek) an emphatic thank you for all your efforts.  For those of you interested, this workflow appears to allow GPS-untagged MOV files to be tagged and properly read by Apple Photos.  Suggestions for streamlining appreciated.

(1)   Create JPG poster frame from MOV files to accept GPS data -- it uses ffmpeg -- if there is a way to do it in exiftool, by all means share!

FOR /F "tokens=*" %G IN ('dir /b *.mov') DO ffmpeg -ss 00:00:00 -i "%G" -vframes 1 -q:v 2 "%~nG.jpg"

(2)   Make sure the poster frames have the same timestamps as the corresponding MOV files (since I am not sure whether DateTimeOriginal, FileModifyDate or FileCreateDate is used, I synch them all):

a.   Run this on all the MOV files:

exiftool -DateTimeOriginal %d%f.MOV -r -ext jpg .

b.   Run this on all the corresponding poster frames:

exiftool -"FileModifyDate<DateTimeOriginal" -"FileCreateDate<DateTimeOriginal"

(3)   If you have a track log file, you can of course do something like "exiftool -geotag=track.log ." on the poster frames to tag them (see https://exiftool.org/geotag.html).  However, if you need one created in the first place (other than inverse geotagging of pictures taken from your cellphone at the same time as the non-GPS camera whose videos/pictures you wish to tag), you could have used a GPS tracking app, like gps4cam, which I did (see http://gps4cam.com/ - I have no financial ties nor do I endorse it).  I ran the gps4cam PC application on the poster frames (and if desired, any still frame pictures taken contemporaneously) – gps4cam-specific note: replace the copy of exiftool gps4cam distributes (5 years old!) along with its Windows/MAC app with a current one at .\resources\exiftool\exiftool.exe on Windows (otherwise, the old exiftool is unable to write to the poster frames created by ffmpeg -- I think it was a big vs little endian problem).

(4)   Copy all the data from the poster frames to the corresponding MOV (i was unsuccessful in limiting it to GPS tags, exiftool would not create them otherwise):

exiftool -TagsFromFile %d%f.jpg -r -ext MOV .

(5)   Create GPSCoordinates tag in the MOV files:

a.   If no altitude data is available:

exiftool "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude"

b.   If altitude data is available:

exiftool "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude, $GPSAltitude"

And then upload them into Apple Photos, et voila!

Best regards!

Phil Harvey

Great, glad this is working for you.  Just a couple of commenst:

Quote from: Tempest Character on June 11, 2019, 02:03:11 PM
(4)   Copy all the data from the poster frames to the corresponding MOV (i was unsuccessful in limiting it to GPS tags, exiftool would not create them otherwise):

exiftool -TagsFromFile %d%f.jpg -r -ext MOV .

Exactly what did you want copied?  You don't have to copy everything blindly if you know what you want copied.

Quotea.   If no altitude data is available:

exiftool "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude"

b.   If altitude data is available:

exiftool "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude, $GPSAltitude"

You can do this in one command:

exiftool -TagsFromFile %d%f.jpg "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude" "-Keys:GPSCoordinates<$GPSLatitude, $GPSLongitude, $GPSAltitude" -ext MOV .

- 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 ($).

Tempest Character

Leave it to the master to show there's almost no limits on the contractions possible!  As to what I wanted to do in (4):

Quote(4)   Copy all the data from the poster frames to the corresponding MOV (i was unsuccessful in limiting it to GPS tags, exiftool would not create them otherwise):

exiftool -TagsFromFile %d%f.jpg -r -ext MOV .

What I really wanted to do is create the Keys:GPSCoordinates tag in the MOV file based on the GPSLatitude, GPSLongitude & GPSAltitude tags in the corresponding poster frame JPG file -- AND I suspect you know how do that in one fell swoop rather than my copying everything over!

Thanks

Phil Harvey

...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 ($).

Tempest Character

It's me again -- thought I wouldn't come back to the well again, but as I started using the Keys:GPSCoordinates tag on .mov files and importing them into the Mac OSX Photos application from various trips, some would come through (i.e., be recognized by Photos) and others would not be recognized.  At first, I thought it might be issues with how I created the .mov files (muxed from AVCHD/MTS files), or whether I was not using a sufficiently recent exiftool version (I now use 11.60), or whether I was somehow else failing to follow the workflow I described earlier in this posting.  Then it hit me -- local pictures (i.e., SF Bay Area) worked, Far East worked, but east coast of North America, Europe, South America failed.  So I created a series of short .mov files and started moving them easterly from California and found the discontinuity at 100º W (and similarly at 100º E) -- that seemed to suggest that 2-digit (and probably 1-digit) longitudes were not being read properly by Photos the way exiftool was formatting them in the Keys:GPSCoordinates flag.  I then tried to see if latitudes had a similar problem, but here the discontinuity occurred at 10º N and S.  I am wondering whether Keys:GPSCoordinates should thus have leading zeroes to pad longitude and latitude to be fully compatible?  Note that the latitude and longitude of the .mov files were readable under GetInfo even when Photos would not show it.  Happy to provide any data should you feel motivated to look into this.  Much thanks!

Phil Harvey

Very interesting.  We are having a similar problem here.  I can update ExifTool to pad the leading digits, but it would be good to know if iPhotos tolerates more digits after the decimal point.  Could you possibly check this?

- 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 ($).

Tempest Character

Appreciate the prompt response -- Apple's Photos app seems insensitive to the number of digits to the right of the decimal point -- the example I gave you only had one, and typical GPS output is 5-7 digits.

Phil Harvey

OK.  ExifTool 11.66 will pad latitude to 2 digits and longitude to 3.  No padding for altitude.

Thanks for figuring this out!

- Phil

Edit: Ah ha!  This is actually part of the specification.  Sorry I missed this.
...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 ($).

Tempest Character


Phil Harvey

...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 ($).

Tempest Character

I thank you for your continued attention to this issue but fear we are (or at least I am) in a "fix-break" cycle. 

(1) On the Mac, the latest version(s) install and run, and I have been able to geotag mov files within +/- 100 E/W, but even though I set the FileCreateDate to DateTimeOriginal (all in 2019), which the Mac Finder recognizes as such, Apple Photos thinks that the mov files are dated in 1969 (I forgot the full date/time, but I can check tonight if interested -- this seems to be before Unix time though!). 

(2) On Windows, any attempt to invoke exiftool gives me this warning: "System Error: The code execution cannot proceed because perl524.dll was not found.  Reinstalling the program may fix this problem."  That happened with versions 11.66, .67 and .68.  I search for perl524.dll and find it in a set of folders at Users\[login]\AppData\Local\Temp\par-7265696368\cache-exiftool-11.6X.  You said elsewhere that these folders can be deleted and exiftool would re-create as needed, but now it seems unable to do so.

Thoughts?

Ariel

Phil Harvey

Hi Ariel,

Nothing should be broken with the new updates.

If exiftool.exe is interrupted the first time it is run, then it may not properly unpack all files into the temporary directory and you can get errors like the missing dll.  To fix this, delete the PAR folder(s) in your temporary directory and run again.

I don't know what date/time Apple Photos is looking for, so I don't know if I can help there.  Are there any date/time tags reported by ExifTool as 1969?  Try this command:

exiftool -time:all -a -G1 -api requestall=2 FILE

- 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 ($).

Tempest Character

On the Windows side, I'm still having problems, despite deleting the PAR folder(s) and rebooting for good measure.

On the Mac side, using your search, I'm not finding any 1969 dates.  However, I am seeing this date field on Apple created mov files that my workflow does not create:

[Keys]          Creation Date                   : 2019:03:10 21:08:17

However, Apple Photos does seem to accept this date that was occasionally created (don't ask me how):

[UserData]      Date/Time Original              : 2019:09:22 12:22:23-07:00

On the other hand, this date alone does not appear to get read:

[XMP-exif]      Date/Time Original              : 2019:04:16 19:27:37

But it does look like progress.  Your collaboration is highly appreciated!

Phil Harvey

I'm not surprised that Apple doesn't read XMP in MOV.  I haven't seen much support for this other than Adobe Bridge.

- 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 ($).

StarGeek

Quote from: Tempest Character on October 02, 2019, 01:41:56 AM
On the Mac side, using your search, I'm not finding any 1969 dates. 

Any other dates before 1970?  Not just 1969?
* 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).

Tempest Character

Hey Stargeek!  No date field from Phil's search shows up with anything but contemporary dates or zeroes.
I'm just wondering if Apple is reading a zero or null field and interpreting it as Dec. 31, 1969, 4:00PM.
Cheers.

Phil Harvey

That's it.  The zero date/time is being interpreted as the start of the epoch, which is Jan 1, 1970 UTC.

- 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 ($).

Hayo Baan

Quote from: Tempest Character on October 02, 2019, 01:32:35 PM
Hey Stargeek!  No date field from Phil's search shows up with anything but contemporary dates or zeroes.
I'm just wondering if Apple is reading a zero or null field and interpreting it as Dec. 31, 1969, 4:00PM.
Cheers.

Just like Phil said. The reason you are seeing it as 31 dec 1969 has to do with your time zone; you live 8:00 hours before UTC)
Hayo Baan – Photography
Web: www.hayobaan.nl

Tempest Character