ExifTool > The Image::ExifTool API

Adding QuickTime GPS tag to video files



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: ---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
--- End code ---

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.



Phil Harvey:
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

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,


Phil Harvey:
Hi Mike,


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


[0] Message Index

Go to full version