Copy GPS info from Quicktime .MOV to EXIF .JPG

Started by u.b.muc, August 07, 2015, 05:09:18 PM

Previous topic - Next topic

u.b.muc

Hi,

I just have sucessfully automated creating thumbnail jpgs from iPhone .MOVs via ffmpeg .
(Unfortunately, iPhone MOV doesn't deliver any embedded .thm with all metadata already there.)

Now I'm trying to automatically copy some key tags from the MOV to the JPG.
Especially the different formats of how GPS data is stored makes me stumble:

In the MOV, I get all gps location in _one_ tag with comma separated values:

ContentCreateDate               : 2015:07:18 17:31:18+02:00
GPSCoordinates                  : 50.753800° N, 11.636300° E, 337 m Above Sea Level


To write EXIF, I need 6 separate values for Latitude, Longitude, Altitude and a Ref for each.

I was hoping it could be as simple as:

-DateTimeOriginal<ContentCreateDate
-GPSTimeStamp<ContentCreateDate
-GPSDateStamp<ContentCreateDate
-GPSLatitude<GPSCoordinates
-GPSLatitudeRef<GPSCoordinates
-GPSLongitude<GPSCoordinates
-GPSLongitudeRef<GPSCoordinates
-GPSAltitude<GPSCoordinates
-GPSAltitudeRef<GPSCoordinates


This results to:

DateTimeOriginal                : 2015:07:18 17:31:18
GPSVersionID                    : 2.3.0.0
GPSLatitude                     : 50.753800°
GPSLongitude                    : 50.753800°
GPSAltitude                     : 50 m
GPSTimeStamp                    : 15:31:18
GPSDateStamp                    : 2015:07:18


So some things are done correctly without any additional handling:

  • DateTimeOriginal stripping timezone getting the local time
  • GPSTimeStamp correctly takes time portion only, stripping timezone getting the time in UTC
  • GPSDateStamp correctly takes date portion only
However, the gps coordinates are messed up.

Looks like I need to do some more pre-processing for the source GPS data? If so - how?
Or am I missing some fancy feature of using composite tags doing the work?

Appreciate if you could point me to the right direction.

Thanks,
u.b.muc

Phil Harvey

I don't have time to test this right now, but try this:

-gpslatitude<${gpscoordinates;my @a=split /, /;$_=$a[0]}
-gpslatituderef<${gpscoordinates;my @a=split /, /;$_=$a[0]}
-gpslongitude<${gpscoordinates;my @a=split /, /;$_=$a[1]}
-gpslongituderef<${gpscoordinates;my @a=split /, /;$_=$a[1]}
-gpsaltitude<${gpscoordinates;my @a=split /, /;$_=$a[2]}
-gpsaltituderef<${gpscoordinates;my @a=split /, /;$_=$a[2]}


Silly me.  There are already pre-defined Composite tags that decompose the QuickTime:GPSCoordinates for you (you should see these in the ExifTool output when reading tags from the .mov file).  So do this:

-gpslatituderef<gpslatitude
-gpslatitude
-gpslongituderef<gpslongitude
-gpslongitude
-gpsaltituderef<gpsaltitude
-gpsaltitude


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

u.b.muc

Great, thanks for the quick response.

I thought there must be something with composite tags, but I somehow didn't manage to find it in the list of composite tags definitions.
And just in this moment I realized I should have checked the option "Show composite values in View ALL" in ExifToolGUI. Then it's very obvious where to go... 

Only one minor correction to your response because one error shows up:

Warning: Can't convert GPS:GPSAltitudeRef (not in PrintConv)


It should read
-gpsaltituderef<gpsaltituderef
instead of
-gpsaltituderef<gpsaltitude

given the composite output as below:


---- Composite ----
GPS Altitude                    : 337 m
GPS Altitude Ref                : Above Sea Level
GPS Latitude                    : 50 deg 45' 13.68" N
GPS Longitude                   : 11 deg 38' 10.68" E
GPS Position                    : 50 deg 45' 13.68" N, 11 deg 38' 10.68" E
Image Size                      : 1920x1080


But now works just fine!


Phil Harvey

Excellent.  Thanks for the correction.

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