Author Topic: reading/writing googlefied mp4 GEO data ?  (Read 220 times)

gibman

  • Newbie
  • *
  • Posts: 5
reading/writing googlefied mp4 GEO data ?
« on: April 14, 2020, 08:44:18 AM »
hi.

I have a bunch of mp4 video files on  my computer that I wish to GEO tag before uploading them to google photos as it's very limited within google photos to geotag the files after they have been uploaded.

Thus I want to be able to geo tag my mp4 home video collection before uploading.

In order to try and gain some  knowledge on where google puts these GEO location data I tried to download a mp4 from google photos which was recently captured with my android phone.
Obviously I verified that GPS location data was intact before downloading. All good here.

Opening the file (which has been googlefied by now) locally with a hex editor I see the LANG/LONG of the file here:

Code: [Select]
  f  i  `  c  c  u  m  ”    Y  a  i  [  `  Ó  S   smhd           gudta   _meta       !hdlr        mdirappl            2ilst   *©xyz   "data       +56.1918+010.0831/šfmdat   2.ÜEé½æÙH·–,Ø Ù#îïx264 - core 155 r2901 7d0ff22 € ¿Éeˆ„_èÄrÏÿšôQ¨Ñ^ZÞj7¯÷®òšñ¢×óHòÃ

seems the geo data (+56.1918+010.0831) is saved in the data tag of the file ?
Is there any way to read/write this tag with exiftool ?

next question would be read/write the "Title" info. I was unable to find this embedded in the mp4 file though.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: reading/writing googlefied mp4 GEO data ?
« Reply #1 on: April 14, 2020, 09:01:06 AM »
Yes ExifTool writes this.

See the QuickTime tags documentation.

Also, search this forum for examples of commands to write this.

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

gibman

  • Newbie
  • *
  • Posts: 5
Re: reading/writing googlefied mp4 GEO data ?
« Reply #2 on: April 15, 2020, 06:57:40 AM »
Thanks for the feedback.

Did look at the docs.

this cmd 'exiftool" -a -G cam.mov' gives me:
[QuickTime]     User Data xyz                   : +56.1918+010.0831/

How do I write this back with some new GPS value ?
And what about those videos files that do not already have this tag "User Data xyz" tag ?
In those cases, how do I add it ?

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: reading/writing googlefied mp4 GEO data ?
« Reply #3 on: April 15, 2020, 07:03:53 AM »
It looks like you are running a very old version of ExifTool.  Either that or something is weird about your file.  Update to the most recent version before proceeding.  This tag should be called GPSCoordinates.

To write it, use

exiftool -gpscoordinates="<some value>" FILE

where the value is in the same format as extracted by ExifTool.

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

gibman

  • Newbie
  • *
  • Posts: 5
Re: reading/writing googlefied mp4 GEO data ?
« Reply #4 on: April 15, 2020, 07:32:51 AM »
I'm using 11.93...

ran this:
exiftool.exe -QuickTime:GPSCoordinates#="50.372821 5.893702 0" -overwrite_original google.mp4
also tried:
exiftool.exe -gpscoordinates="+57.1918+010.0832" -overwrite_original google.mp4

(random GPs values)

then for verification:
exiftool.exe -a -G google.mp4

Code: [Select]
[ExifTool]      ExifTool Version Number         : 11.93
[File]          File Name                       : google.mp4
[File]          Directory                       : .
[File]          File Size                       : 26 MB
[File]          File Modification Date/Time     : 2020:04:15 13:29:33+02:00
[File]          File Access Date/Time           : 2020:04:15 13:29:33+02:00
[File]          File Creation Date/Time         : 2020:04:14 14:32:21+02:00
[File]          File Permissions                : rw-rw-rw-
[File]          File Type                       : MP4
[File]          File Type Extension             : mp4
[File]          MIME Type                       : video/mp4
[QuickTime]     Major Brand                     : MP4 v2 [ISO 14496-14]
[QuickTime]     Minor Version                   : 0.0.0
[QuickTime]     Compatible Brands               : isom, mp42
[QuickTime]     Movie Header Version            : 0
[QuickTime]     Create Date                     : 2020:04:10 13:49:04
[QuickTime]     Modify Date                     : 2020:04:10 23:38:24
[QuickTime]     Time Scale                      : 29787
[QuickTime]     Duration                        : 21.18 s
[QuickTime]     Preferred Rate                  : 1
[QuickTime]     Preferred Volume                : 100.00%
[QuickTime]     Matrix Structure                : 1 0 0 0 1 0 0 0 1
[QuickTime]     Preview Time                    : 0 s
[QuickTime]     Preview Duration                : 0 s
[QuickTime]     Poster Time                     : 0 s
[QuickTime]     Selection Time                  : 0 s
[QuickTime]     Selection Duration              : 0 s
[QuickTime]     Current Time                    : 0 s
[QuickTime]     Next Track ID                   : 3
[QuickTime]     Track Header Version            : 0
[QuickTime]     Track Create Date               : 2020:04:10 23:38:24
[QuickTime]     Track Modify Date               : 2020:04:10 23:38:24
[QuickTime]     Track ID                        : 1
[QuickTime]     Track Duration                  : 21.05 s
[QuickTime]     Track Layer                     : 0
[QuickTime]     Track Volume                    : 0.00%
[QuickTime]     Matrix Structure                : 1 0 0 0 1 0 0 0 1
[QuickTime]     Image Width                     : 1920
[QuickTime]     Image Height                    : 1080
[QuickTime]     Media Header Version            : 0
[QuickTime]     Media Create Date               : 2020:04:10 23:38:24
[QuickTime]     Media Modify Date               : 2020:04:10 23:38:24
[QuickTime]     Media Time Scale                : 29787
[QuickTime]     Media Duration                  : 21.05 s
[QuickTime]     Media Language Code             : und
[QuickTime]     Handler Type                    : Video Track
[QuickTime]     Handler Description             : ISO Media file produced by Google Inc. Created on: 04/10/2020.
[QuickTime]     Compressor ID                   : avc1
[QuickTime]     Source Image Width              : 1920
[QuickTime]     Source Image Height             : 1080
[QuickTime]     X Resolution                    : 72
[QuickTime]     Y Resolution                    : 72
[QuickTime]     Bit Depth                       : 24
[QuickTime]     Video Frame Rate                : 29.787
[QuickTime]     Graphics Mode                   : srcCopy
[QuickTime]     Op Color                        : 0 0 0
[QuickTime]     Track Header Version            : 0
[QuickTime]     Track Create Date               : 2020:04:10 23:38:24
[QuickTime]     Track Modify Date               : 2020:04:10 23:38:24
[QuickTime]     Track ID                        : 2
[QuickTime]     Track Duration                  : 21.18 s
[QuickTime]     Track Layer                     : 0
[QuickTime]     Track Volume                    : 100.00%
[QuickTime]     Matrix Structure                : 1 0 0 0 1 0 0 0 1
[QuickTime]     Media Header Version            : 0
[QuickTime]     Media Create Date               : 2020:04:10 23:38:24
[QuickTime]     Media Modify Date               : 2020:04:10 23:38:24
[QuickTime]     Media Time Scale                : 44100
[QuickTime]     Media Duration                  : 21.18 s
[QuickTime]     Media Language Code             : eng
[QuickTime]     Handler Type                    : Audio Track
[QuickTime]     Handler Description             : ISO Media file produced by Google Inc. Created on: 04/10/2020.
[QuickTime]     Audio Format                    : mp4a
[QuickTime]     Audio Channels                  : 2
[QuickTime]     Audio Bits Per Sample           : 16
[QuickTime]     Audio Sample Rate               : 44100
[QuickTime]     Balance                         : 0
[QuickTime]     Handler Type                    : Metadata
[QuickTime]     Handler Vendor ID               : Apple
[QuickTime]     User Data xyz                   : +56.1918+010.0831/
[QuickTime]     GPS Coordinates                 : 50 deg 22' 22.16" N, 5 deg 53' 37.33" E, 0 m Above Sea Level
[QuickTime]     Media Data Size                 : 26895886
[QuickTime]     Media Data Offset               : 7959
[Composite]     Image Size                      : 1920x1080
[Composite]     Megapixels                      : 2.1
[Composite]     Avg Bitrate                     : 10.2 Mbps
[Composite]     GPS Altitude                    : 0 m
[Composite]     GPS Altitude Ref                : Above Sea Level
[Composite]     GPS Latitude                    : 50 deg 22' 22.16" N
[Composite]     GPS Longitude                   : 5 deg 53' 37.33" E
[Composite]     Rotation                        : 0
[Composite]     GPS Position                    : 50 deg 22' 22.16" N, 5 deg 53' 37.33" E

it only seems to update the GPS position data tag, sadly google ignores this.
The "user data xyz" is apparently untouched. Ideally I wanted to update this tag :)
Or both in fact.
« Last Edit: April 15, 2020, 07:50:59 AM by gibman »

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: reading/writing googlefied mp4 GEO data ?
« Reply #5 on: April 15, 2020, 08:44:16 AM »
This is very odd.  Send me a (small if possible) file with the User Data xyz tag and I'll take a look.  (philharvey66 at gmail.com)

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

gibman

  • Newbie
  • *
  • Posts: 5
Re: reading/writing googlefied mp4 GEO data ?
« Reply #6 on: April 15, 2020, 10:22:07 AM »
u got mail :)

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: reading/writing googlefied mp4 GEO data ?
« Reply #7 on: April 15, 2020, 01:06:06 PM »
I see now.  I was thrown because of the "UserData" in the generated tag name.  But if you check the actual location (with the -G1 option) it is in the ItemList.  I hadn't seen a ©xyz tag in the ItemList before, but I'll add support for this and you will be able read/write this as ItemList:GPSCoordinates with ExifTool 11.94 when it is released.

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

gibman

  • Newbie
  • *
  • Posts: 5
Re: reading/writing googlefied mp4 GEO data ?
« Reply #8 on: April 18, 2020, 06:57:58 AM »
Thanks for the new release.
It appears to work when using : exiftool.exe -gpscoordinates="+57.1918+010.0832" -overwrite_original google.mp4
google photos picks this up correctly now.. awesome.

Next problem is that I have a bunch of mov/mp4 files with XMP sidecar files that all have their GPS coordinates.
In fact these XML files are created using the geotagger (tool).

here's an exerpt from on of the XMP files:
Code: [Select]
<rdf:Description rdf:about=''
  xmlns:exif='http://ns.adobe.com/exif/1.0/'>
  <exif:GPSAltitude>46/1</exif:GPSAltitude>
  <exif:GPSAltitudeRef>0</exif:GPSAltitudeRef>
  <exif:GPSImgDirection>0/1</exif:GPSImgDirection>
  <exif:GPSImgDirectionRef>M</exif:GPSImgDirectionRef>
  <exif:GPSLatitude>56,11.494524N</exif:GPSLatitude>
  <exif:GPSLongitude>10,5.013354E</exif:GPSLongitude>
  <exif:GPSMapDatum>WGS-84</exif:GPSMapDatum>
  <exif:GPSTimeStamp>1899-12-30T01:00:00Z</exif:GPSTimeStamp>
  <exif:GPSVersionID>2.2.0.0</exif:GPSVersionID>
 </rdf:Description>

Is there a builtin method to extract the XMP exif tags here for Lat/Long coords and convert those to the format '+57.1918+010.0832' and then finally write it back to the mov/mp4 file (embedded quicktime tag)?

I tried:
exiftool.exe" -tagsfromfile "google.xmp" -all:all -overwrite_original google.mov
But it doesnt seem to write the quicktime GPS coordinates.

Or do I need to handle this using some scripting language?
something along the lines that reads the XMP coords, converts the GPS coords, then calls exiftool with -gpscoordinates


again thanks for your work.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 16510
    • ExifTool Home Page
Re: reading/writing googlefied mp4 GEO data ?
« Reply #9 on: April 18, 2020, 07:25:11 AM »
Just do this:

exiftool -tagsfromfile %d%f.xmp "-gpscoordinates<gpsposition" -ext mov -ext mp4 DIR

Converting the coordinates isn't necessary.  ExifTool will handle that.  In fact, it handled the conversion for your previous command as well, since you didn't format it as expected (see FAQ 14).

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