Author Topic: GPS tags for mp4 in Google Photos  (Read 652 times)

karlgustavv

  • Jr. Member
  • **
  • Posts: 27
GPS tags for mp4 in Google Photos
« on: April 12, 2020, 06:58:03 AM »
It is now possible to set the Keys:GPSCoordinates tag for mp4 files, which is a great addition to exiftool.

I set the coordinates in a (thumbnail) JPEG file and then transfer them to the mp4 file:

exiftool -tagsfromfile source.jpg "-keys:GPSCoordinates<$GPSLatitude, $GPSLongitude, $GPSAltitude" dest.mp4

Google Photos does not recognize the position in this way, since the altitude obviously cannot be processed.

New attempt without the altitude:
exiftool -tagsfromfile source.jpg "-keys:GPSCoordinates<$GPSLatitude, $GPSLongitude" dest.mp4

Now Google Photos recognizes the position for some files and for some not.

The reason seems to be the length of the coordinates:
too long:
Code: [Select]
GPS Coordinates : 50.9780430499889 7.01786347999278
works:
Code: [Select]
GPS Coordinates : 50.9780430499889 7.01786347
My workaround is not elegant: Export coordinates of source.jpg, shorten them in a script, then write them back to source.jpg and in the end: copy them into the mp4 file using the command mentioned above.

The file dest.mp4 is a few bytes smaller with the shortened coordinates and Google Photos can read the coordinates.

Is there a way to tell exiftool to write the position with fewer bytes?

Thanks a lot

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 18370
    • ExifTool Home Page
Re: GPS tags for mp4 in Google Photos
« Reply #1 on: April 12, 2020, 08:02:36 AM »
I think you are not telling the whole story.  Are you using the -n option when copying the coordinates?  You must be.  Either that or you are using a config file to do something like this.

Instead, just use the -c option to format the coordinates however you want.  You can specify the number of decimal places like this:

exiftool -tagsfromfile source.jpg -c %.8f "-keys:GPSCoordinates<$GPSLatitude, $GPSLongitude" dest.mp4

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

karlgustavv

  • Jr. Member
  • **
  • Posts: 27
Re: GPS tags for mp4 in Google Photos
« Reply #2 on: April 12, 2020, 02:09:15 PM »
Thank you for the fast answer.

I've set all sorts of things. And the solution is so simple. Thanks again