How to cleanly add GPS metadata to movie (mp4/mov)

Started by zeus64, July 22, 2021, 05:43:17 PM

Previous topic - Next topic

zeus64

Hello, How to cleanly add GPS metadata to a movie (.mp4 or .mov) ?
If we can not do it with exiftool, is there any other tools who can do it?

I tried like this :

ExifTool.exe -GPSLatitude=10 -GPSLatitudeRef=N -GPSLongitude=15 -GPSLongitudeRef=E mymovie.mp4
but it's seam to not work with amazon photos. What did I forget to do ?

Thanks you by advance!

StarGeek

That command will set the XMP GPS coordinates, which few programs other than Adobe ones will read.  Also, the *Ref tags don't exist for XMP.  The direction is included in the main tag.

For videos, you need to set the GPSCoordinates tag, which includes all three coordinates, Latitude/Longitude/Altitude.

Google is picky, though, and you shouldn't use more than five decimal places or Google may ignore the coordinates.

Your command would be something like
exiftool -GPSCoordinates="40.6892, -74.0445, 10" mymovie.mp4
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

zeus64

Quote from: StarGeek on July 22, 2021, 06:49:31 PM
That command will set the XMP GPS coordinates, which few programs other than Adobe ones will read.  Also, the *Ref tags don't exist for XMP.  The direction is included in the main tag.

For videos, you need to set the GPSCoordinates tag, which includes all three coordinates, Latitude/Longitude/Altitude.

Google is picky, though, and you shouldn't use more than five decimal places or Google may ignore the coordinates.

Your command would be something like
exiftool -GPSCoordinates="40.6892, -74.0445, 10" mymovie.mp4

So you mean for movies no need to do

ExifTool.exe -GPSLatitude=10 -GPSLatitudeRef=N -GPSLongitude=15 -GPSLongitudeRef=E mymovie.mp4

but instead I must do

exiftool -GPSCoordinates="40.6892, -74.0445, 0" mymovie.mp4

right?

one question, when i look Iphone movies (.mov) i saw that the GPSCoordinates is in "Keys" section and when I look an android movie (*.mp4) I see that the GPSCoordinates  is in the "userdata" section. when I set the GPSCoordinates with exiftool -GPSCoordinates="40.6892, -74.0445, 0" mymovie.mp4 i saw that the GPSCoordinates is set in the "itemlist" section. Is this matter? what is exactly a section or group? do I need to do :

exiftool -Keys:GPSCoordinates="40.6892, -74.0445, 0" -Userdata:GPSCoordinates="40.6892, -74.0445, 0" -Itemlist:GPSCoordinates="40.6892, -74.0445, 0" mymovie.mp4

to be compatible with everyone ?

On the net I saw also some screenshot where the GPSCoordinates is set in the "quicktime" section, but I don't know how to do this with exiftool ?

Phil Harvey

QuickTime is the overall format and the family 0 group for all of these tags.  (See the QuickTime tags documentation.)  The location (family 1 group) that you should use depends on the software you want to use with this.  I can see reference to all 3 locations when I search this forum, so I can't quickly determine which one might be best to use.

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

StarGeek

Quote from: zeus64 on July 23, 2021, 04:17:38 AM
So you mean for movies no need to do

ExifTool.exe -GPSLatitude=10 -GPSLatitudeRef=N -GPSLongitude=15 -GPSLongitudeRef=E mymovie.mp4

Only if you need an Adobe program to read the coordinates in a video file, and you would remove the GPSLatitudeRef/GPSLongitudeRef and include the direction in the GPSLatitude/GPSLongitude, e.g. -GPSLatitude="10 N" -GPSLongitude="15 E".

QuoteIs this matter? what is exactly a section or group? do I need to do :

exiftool -Keys:GPSCoordinates="40.6892, -74.0445, 0" -Userdata:GPSCoordinates="40.6892, -74.0445, 0" -Itemlist:GPSCoordinates="40.6892, -74.0445, 0" mymovie.mp4

to be compatible with everyone ?

At one point, I had a problem with Google Photos not reading ItemList:GPSCoordinates coordinates, but it worked in the test I did just now.  If you want maximum compatibility, you can set all three, it shouldn't cause any problems.

QuoteOn the net I saw also some screenshot where the GPSCoordinates is set in the "quicktime" section, but I don't know how to do this with exiftool ?

Your command above sets the GPSCoordinates in all three Quicktime sub-groups, Family 1 groups as Phil says.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

drake.orfeo

#5
SOLVED
Thous shalt not run
exiftool -Keys:GPSCoordinates="..." -Userdata:GPSCoordinates="..." -Itemlist:GPSCoordinates="..." mymovie.mp4with Windows executable version 12.49
but run the -tags in 3 separate commands

Read on for why

I'm trying to manually set the GPS to a compressed mp4
exiftool -Keys:GPSCoordinates="..." -Userdata:GPSCoordinates="..." -Itemlist:GPSCoordinates="..." mymovie.mp4or
exiftool -GPSCoordinates="..." mymovie.mp4
then I ran exiftool thefile.mp4

Original Android file:
...
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
...
Next Track ID                   : 3
GPS Coordinates                 : * deg *' *.*" N, 0 deg 0' *.*" E
Android Version                 : 10
Track Header Version            : 0
...
Avg Bitrate                     : 8.17 Mbps
GPS Latitude                    : * deg *' *.*" N
GPS Longitude                   : 0 deg 0' *.*" E
Rotation                        : 90
GPS Position                    : * deg *' *.*" N, 0 deg 0' *.*" E

Compressed file:
...
MIME Type                       : video/mp4
Major Brand                     : MP4 v2 [ISO 14496-14]
...
Next Track ID                   : 202
Track Header Version            : 0
...
Avg Bitrate                     : 2.44 Mbps
GPS Altitude                    : 0 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : * deg *' *.*" N
GPS Longitude                   : 0 deg 0' *.*" E
Rotation                        : 0
GPS Position                    : * deg *' *.*" N, 0 deg 0' *.*" E

While most GPS properties are set, the attribute "GPS Coordinates" (after Next Track ID ) is still missing from the compressed file and Google Photos could not recognize it nor show the map.

Then I ran
exiftool -Userdata:GPSCoordinates="" mymovie.mp4alone and the attribute "GPS Coordinates" is set and the map appears on Google Photos

drake.orfeo

PS thou shalt not run
exiftool -Userdata:GPSCoordinates="x,y,H" mymovie.mp4
Google Photos cannot take the 3rd parameter (,H Latitude) as of today 2022-11-5

wywh

Quote from: drake.orfeo on November 05, 2022, 04:48:29 PMGoogle Photos cannot take the 3rd parameter (,H Latitude)

Thanks for the alert. I usually do not have altitudes in my Google Photos.

Apple's apps use only Keys for GPS and this works today also in Google Photos:

exiftool -m -P -overwrite_original_in_place -Keys:GPSCoordinates='-36.6101, -66.91515, 119.9' movie.mp4
I currently make sure that there are min 3 and max 5 decimals after the dot in Google Photos movies because otherwise it might not work.

"ExifTool already has a patch for writing GPSCoordinates because Google Photos didn't accept coordinates with less than 3 digits after the decimal place"

hmm ... but I seemingly can write just one decimal just fine...

exiftool -Keys:GPSCoordinates='-36.6, -66.9, 119.9' movie.mp4

exiftool -a -G1 -s -n -Location:All movie.mp4
[Keys]          GPSCoordinates                  : -36.6 -66.9 119.9

https://exiftool.org/forum/index.php?topic=11055.msg67180#msg67180

Some apps might insist that the latitude has 2 and longitude 3 digits before the dot.

https://exiftool.org/forum/index.php?topic=11055.msg63492#msg63492

- Matti

Phil Harvey

Quote from: wywh on November 06, 2022, 04:05:32 AMbut I seemingly can write just one decimal just fine...

I don't think so.

Use the -v2 option to see what is actually written.  The -n option may drop trailing zeros when reading back.

- 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 November 07, 2022, 12:02:37 PMUse the -v2 option to see what is actually written

Oh, thanks for the tip. exiftool 12.49:

exiftool -v2 -Keys:GPSCoordinates='-1, -1, 1' movie.mp4                                             
[...]
    - Keys:GPSCoordinates-und = '-36.6101-066.91515+119.900/'
    + Keys:GPSCoordinates-und = '-01.000-001.000+1.000/'

exiftool -a -G1 -s -n -Location:All movie.mp4         
[Keys]          GPSCoordinates                  : -1 -1 1

exiftool -a -G1 -s -Location:All movie.mp4
[Keys]          GPSCoordinates                  : 1 deg 0' 0.00" S, 1 deg 0' 0.00" W, 1 m Above Sea Level

- Matti