Author Topic: Adding QuickTime GPS tag to video files  (Read 375 times)

MikeB

  • Newbie
  • *
  • Posts: 2
Adding QuickTime GPS tag to video files
« on: October 06, 2019, 08:49:56 AM »
Hi,

First of all, as a new poster: Thank you Phil Harvey for the incredible work creating and updating ExifTool! It's been incredibly helpful to clean up and annotate my photo library.

I have a problem adding or changing GPS coordinates in video files. I am using perl and writing GPS coordinates to video files like this (not the full script, just the relevant lines):

Code: [Select]
my $exifTool = new Image::ExifTool;
$exifTool->Options(QuickTimeUTC => 1);
my $info = $exifTool->ImageInfo($file);
$exifTool->SetNewValue('QuickTime:GPSCoordinates', $GPSCoordinates); # With GPSCoordinates e.g. containing 51 deg 23' 51.08" N, 5 deg 59' 7.44" E, 29.756 m Above Sea Level
$exifTool->WriteInfo($file);

As a test case, I am using a file straight from my iPhone XR. After updating a file with new coordinates in this way, I found that both the Apple and Windows photos apps no longer recognize the GPS location of the video file. After some more digging, I noticed that writing coordinates to a video with existing coordinates results in two QuickTime:GPSCoordinates tags. When I check the tag IDs, I find that the original Apple embedded tag has '1.1' as the ID, while the tag written by ExifTool has '(copyright symbol)xyz' as the tag ID. If I strip the tags first and then write the tag fresh, I get only the tag with the xyz ID. I am guessing that this is the underlying cause for the problem, and that a tag with the '1.1' ID is needed, but this is a bit beyond my knowledge.

So my question is: how can I write GPS coordinate tags to video files in a way that Apple/Microsoft photos apps recognize the location.

Thanks,

Mike

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Adding QuickTime GPS tag to video files
« Reply #1 on: October 06, 2019, 02:12:38 PM »
Hi Mike,

What version of ExifTool are you using?  There was a bug fix in this area very recently.

Also, you should be writing Keys:GPSCoordinates to write the one with the numerical (key) ID instead of the xyz ID.  See the second paragraph of the QuickTime tags documentation for more information about this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

MikeB

  • Newbie
  • *
  • Posts: 2
Re: Adding QuickTime GPS tag to video files
« Reply #2 on: October 07, 2019, 12:31:49 PM »
Dear Phil,

Thanks for the quick answer! All my problems were solved. Writing Keys:GPSCoordinates wrote the coordinates in the right place, and updating from 11.65 to 11.69 made it possible to have both the 1.1 and xyz GPS coordinates present in one file. I assume some software (Android/Google?) will be looking for GPS data in the xyz location, so I am now embedding in both locations.

Best wishes,

Mike

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 15224
    • ExifTool Home Page
Re: Adding QuickTime GPS tag to video files
« Reply #3 on: October 07, 2019, 12:38:15 PM »
Hi Mike,

Great!

Just FYI, version 11.65 could write GPSCoordinates to both locations, but there were format problems that made it unreadable by some other apps.  With 11.69 and later these format problems are fixed.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).