GPS tags for mp4 in Google Photos

Started by karlgustavv, April 12, 2020, 06:58:03 AM

Previous topic - Next topic

karlgustavv

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:
GPS Coordinates : 50.9780430499889 7.01786347999278

works:
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

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/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

karlgustavv

Thank you for the fast answer.

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

Martin314

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

> The reason seems to be the length of the coordinates:

My experience is similar, but it seems that for me that the maximum length is shorter.  I started with 6 digits after the decimal point and that worked for the first few videos, but then I ran into one that I had to shorten it to only 5 digits after (the length before the decimal was longer, so perhaps it's the entire length of either one or both numbers).