Get EXIF Data into Lightroom without damaging Sony video properties

Started by sebm, January 28, 2023, 07:03:09 AM

Previous topic - Next topic

sebm

Hi.
Using EXIFTOOL I get this from a SONY MTS file:
GPS Position: 15 deg 55' 27.83" S, 5 deg 43' 7.34" W

I'm not sure if it's visible to Lightroom at all, but it's not interpretable as even when I paste it, it wants a ° instead of deg.

Any suggestions on how I can reformat during a copy to be EXIF compatible (I'm going to save them into XMP sidecars with GPS info). Is there a helper or is there a search/replace function in an EXIF transaction I can do without ruining the original data (which Sony reads)

StarGeek

The -c (-coordFormat) option will reformat the coordinates in any way you want.  Or you can add a hashtag to the end of the tag (shortcut for the -n (--printConv) option) which will return the entire thing as a decimal, which probably should be acceptable to LR.

But I think the best bet would be to load the files into LR so that it creates the XMP sidecars, then you can use the gps2xmp.args file to copy the gps coordinates into the sidecar file.  The -ext (-extension) option is used to skip the XMP files because you don't want to copy them back onto themselves.

exiftool -@ /path/to/gps2xmp.args --ext xmp /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

sebm

Thanks for this. Is there a way to limit the command to ignore the GPS Date Stamp and GPS TIme Stamp (which you'll see I'm having to play with with another post here).

Apologies - this is a seriously steep learning curve with an amazing tool!!

Phil Harvey

Add --gpsdatetime to the end of the command to avoid copying GPSDateStamp and GPSTimeStamp to XMP:GPSDateTime

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

sebm

#4
HI - something not working with this command:
exiftool -ext mts "-gpslongitude<gpslongitude" -c %.6f -srcfile %d%f.xmp "D:\Seb Documents\My Videos\Need Sorting\MTS Files not rejected\Change Dates-SIN"

It even says it's updated the files but it doesn't update anything.

I can't do the printconv argument as it misses the hemisphere letter.

Any tips? Do I need to delete the pre-existing tags in the xmp files from my earlier exif2xmp before copying over reformatted GPS from the mts files? Also - can XMP hold altitude? Tks!

Phil Harvey

If ExifTool says it updated a file, then it did.  But if you are trying to write MTS files, you should be seeing this message:

Error: Writing of MTS files is not yet supported
- 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: sebm on February 02, 2023, 05:33:13 AMHI - something not working with this command:
exiftool -ext mts "-gpslongitude<gpslongitude" -c %.6f -srcfile %d%f.xmp "D:\Seb Documents\My Videos\Need Sorting\MTS Files not rejected\Change Dates-SIN"

It even says it's updated the files but it doesn't update anything.

What are you using to check if something has been updated.  If it's not exiftool, it helps if you tell us what you're using.

This command should be updating the XMP based upon data in the MTS file.  That's what happens with my testing, though I'm using a jpg instead of a MTS file

C:\>exiftool -G1 -a -s -gps* y:\!temp\Test4.jpg y:\!temp\Test4.xmp
======== y:/!temp/Test4.jpg
[GPS]          GPSVersionID                    : 2.3.0.0
[GPS]          GPSLatitudeRef                  : North
[GPS]          GPSLatitude                    : 0 deg 0' 0.00"
[GPS]          GPSLongitudeRef                : East
[GPS]          GPSLongitude                    : 0 deg 0' 0.00"
[Composite]    GPSLatitude                    : 0 deg 0' 0.00" N
[Composite]    GPSLongitude                    : 0 deg 0' 0.00" E
[Composite]    GPSPosition                    : 0 deg 0' 0.00" N, 0 deg 0' 0.00" E
======== y:/!temp/Test4.xmp
[XMP-exif]      GPSLatitude                    : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 74 deg 2' 40.20" W
[Composite]    GPSLatitudeRef                  : North
[Composite]    GPSLongitudeRef                : West
[Composite]    GPSPosition                    : 40 deg 41' 21.12" N, 74 deg 2' 40.20" W
    2 image files read

C:\>exiftool -ext jpg "-gpslongitude<gpslongitude" -c %.6f -srcfile %d%f.xmp y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -gps* y:\!temp\Test4.jpg y:\!temp\Test4.xmp
======== y:/!temp/Test4.jpg
[GPS]          GPSVersionID                    : 2.3.0.0
[GPS]          GPSLatitudeRef                  : North
[GPS]          GPSLatitude                    : 0 deg 0' 0.00"
[GPS]          GPSLongitudeRef                : East
[GPS]          GPSLongitude                    : 0 deg 0' 0.00"
[Composite]    GPSLatitude                    : 0 deg 0' 0.00" N
[Composite]    GPSLongitude                    : 0 deg 0' 0.00" E
[Composite]    GPSPosition                    : 0 deg 0' 0.00" N, 0 deg 0' 0.00" E
======== y:/!temp/Test4.xmp
[XMP-exif]      GPSLatitude                    : 40 deg 41' 21.12" N
[XMP-exif]      GPSLongitude                    : 0 deg 0' 0.00" E
[Composite]    GPSLatitudeRef                  : North
[Composite]    GPSLongitudeRef                : East
[Composite]    GPSPosition                    : 40 deg 41' 21.12" N, 0 deg 0' 0.00" E

Quote from: sebm on February 02, 2023, 05:33:13 AMAlso - can XMP hold altitude?

Yes.  See the XMP-exif tag names.

The XMP:GPSAltitude tag is a bit different than the XMP versions of GPSLatitude/GPSLongitude.  The latter two include the reference direction in the tag (unlike the EXIF GPS tags) but the XMP:GPSAltitude holds the Above/Below direction separately in XMP:GPSAltitudeRef.

An easy shortcut is to use a wildcard when writing
C:\>exiftool -P -overwrite_original -all= -XMP:GPSAltitude*=-100 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -gps* y:\!temp\Test4.jpg
[XMP-exif]      GPSAltitude                     : 100 m
[XMP-exif]      GPSAltitudeRef                  : Below Sea Level
[Composite]     GPSAltitude                     : 100 m Below Sea Level

C:\>exiftool -P -overwrite_original -all= -XMP:GPSAltitude*=+200 y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -gps* y:\!temp\Test4.jpg
[XMP-exif]      GPSAltitude                     : 200 m
[XMP-exif]      GPSAltitudeRef                  : Above Sea Level
[Composite]     GPSAltitude                     : 200 m Above Sea Level
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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

sebm

Hi Phil and thanks for helping.

I know it's not working because I get this when I read the xmp file aftewards:
GPS Latitude                    : 15 deg 56' 12.10" S
GPS Longitude                   : 5 deg 42' 34.06" W
GPS Position                    : 15 deg 56' 12.10" S, 5 deg 42' 34.06" W

It says 191 image files updated. But then I look and the contents are still in degrees minutes and seconds not in decimals as they should be given the -c %.6f argument. Have tried with =c "%+.6f" and the same result. And I don't want to lose the hemisphere with printconv. Any tips?


That arguments works fine when reading the files. Or
The option for -c %.6f should be making these decimals but it's not. I initially filled the XMPs based on an earlier exif2xmp.args file.

Phil Harvey

Quote from: sebm on February 09, 2023, 03:33:16 AMI look and the contents are still in degrees minutes and seconds

How are you looking at the contents?

The -c option effects how ExifTool displays GPS coordinates when reading.  It doesn't affect the way they are stored in the file because this is dictated by the relevant specification.

- 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

As Phil says, you can't force the spec to be written another way.  If you could, it wouldn't a viable spec.

Example of the values saved in a XMP file. They are saved as Degrees,Minutes where Minutes will probably have a decimal value which will be used to calculate the Seconds.
C:\>exiftool -P -overwrite_original -GPSLatitude=40.6892 -GPSLongitude=-74.0445 y:\!temp\Test4.xmp
    1 image files updated

C:\>type y:\!temp\Test4.xmp
<?xpacket begin='�' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 12.55'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

 <rdf:Description rdf:about=''
  xmlns:exif='http://ns.adobe.com/exif/1.0/'>
  <exif:GPSLatitude>40,41.352N</exif:GPSLatitude>
  <exif:GPSLongitude>74,2.67W</exif:GPSLongitude>
 </rdf:Description>
</rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>

The EXIF GPS tags are saved differently.  They are saved as three fraction, for a total of six numbers.  In the verbose listing below, on the GPSLatitude line, you can see the fractions of (40/1 41/1 528/25).  For the GPSLongitude, the values are (74/1 2/1 201/5)


  | | 1)  GPSLatitudeRef = N
  | |     - Tag 0x0001 (2 bytes, string[2]):
  | |         007c: 4e 00                                           [N.]
  | | 2)  GPSLatitude = 40 41 21.12 (40/1 41/1 528/25)
  | |     - Tag 0x0002 (24 bytes, rational64u[3]):
  | |         00a8: 00 00 00 28 00 00 00 01 00 00 00 29 00 00 00 01 [...(.......)....]
  | |         00b8: 00 00 02 10 00 00 00 19                         [........]
  | | 3)  GPSLongitudeRef = W
  | |     - Tag 0x0003 (2 bytes, string[2]):
  | |         0094: 57 00                                           [W.]
  | | 4)  GPSLongitude = 74 2 40.2 (74/1 2/1 201/5)
  | |     - Tag 0x0004 (24 bytes, rational64u[3]):
  | |         00c0: 00 00 00 4a 00 00 00 01 00 00 00 02 00 00 00 01 [...J............]
  | |         00d0: 00 00 00 c9 00 00 00 05                         [........]
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).