Copy GPS to Geolocation city tags in movies

Started by wywh, June 13, 2024, 05:20:17 PM

Previous topic - Next topic

wywh

What is the best way to copy GPS to geolocation city tags in movies?

This command does not work because it overwrites existing Keys:GPSCoordinates with the Geolocation GPS which might be several kilometers away from the initial spot:

exiftool -overwrite_original '-Keys:XMP-photoshop:XMP-iptcCore:Geolocate<GPSPosition' movie.mp4
I tried to omit overwriting it with '--Keys:GPSCoordinates' but that did not seem to work.

Is this the best way to do it:

exiftool -overwrite_original '-Keys:XMP-photoshop:XMP-iptcCore:Geolocate<GPSPosition' -TagsFromFile @ -Keys:GPSCoordinates movie.mp4
None of my apps read XMP in movies so I might omit 'XMP-photoshop:XMP-iptcCore' from that command.

With images this is not a problem and this works OK (I do not write IPTC because it lacks CountryCode and it might be better to stop writing also IPTC anyway):

exiftool -overwrite_original '-XMP:Geolocate<GPSPosition' image.jpg
- Matti

StarGeek

Quote from: wywh on June 13, 2024, 05:20:17 PM(I do not write IPTC because it lacks CountryCode and it might be better to stop writing also IPTC anyway)

IPTC:Country-PrimaryLocationCode is the equivalent of XMP-iptcCore:CountryCode, but I agree with the second point.
* 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).

wywh

Quote from: StarGeek on June 13, 2024, 05:46:11 PMIPTC:Country-PrimaryLocationCode is the equivalent of XMP-iptcCore:CountryCode

Thanks for the note. My app does not read that IPTC tag while it does read the corresponding XMP tag. FWIW there is a warning if two letter code is used:

exiftool -overwrite_original -IPTC:Country-PrimaryLocationCode=US image.jpg
Warning: [Minor] String too short for IPTC:Country-PrimaryLocationCode (padded) - image.jpg

- Matti

Phil Harvey

Hi Matti,

Quote from: wywh on June 13, 2024, 05:20:17 PMIs this the best way to do it:

exiftool -overwrite_original '-Keys:XMP-photoshop:XMP-iptcCore:Geolocate<GPSPosition' -TagsFromFile @ -Keys:GPSCoordinates movie.mp4

I think what you want is simply:

exiftool -overwrite_original '-Geolocate<GPSPosition' movie.mp4
As per the table here, this will write:

XMP:City
XMP:State
XMP:CountryCode
XMP:Country
Keys:LocationName

Which should do the same thing as your command.

You raise an interesting point about Keys overwriting Keys:GPSCoordinates when input coordinates are specified.  I should think about 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 ($).

wywh

Quote from: Phil Harvey on June 13, 2024, 08:46:04 PMI think what you want is simply:

exiftool -overwrite_original '-Geolocate<GPSPosition' movie.mp4

Thanks for reminding me that this feature was added in 12.81.

The same simple command works also for images:

exiftool -overwrite_original '-Geolocate<GPSPosition' image.jpg
- Matti


Phil Harvey

I'll patch ExifTool 12.88 to write Keys:GPSPosition only when an input city name is provided, and Keys:LocationName only with input GPS when the Keys group is specified.

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