Photos.app .xmp to movies

Started by wywh, January 05, 2022, 12:45:44 PM

Previous topic - Next topic

wywh

macOS 12 Monterey Photos.app 7 exports .mp4, .m4v and .mov movie .xmp sidecars with "Export IPTC as XMP" option as:

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
   <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/"
            xmlns:dc="http://purl.org/dc/elements/1.1/"
            xmlns:photoshop="http://ns.adobe.com/photoshop/1.0/">
         <exif:GPSLongitude>70.650466100000003</exif:GPSLongitude>
         <exif:GPSLongitudeRef>W</exif:GPSLongitudeRef>
         <exif:GPSHPositioningError>1</exif:GPSHPositioningError>
         <exif:GPSLatitude>33.451855799999997</exif:GPSLatitude>
         <exif:GPSLatitudeRef>S</exif:GPSLatitudeRef>
         <exif:GPSTimeStamp>2022-01-05T16:56:46Z</exif:GPSTimeStamp>
         <dc:title>Title</dc:title>
         <dc:description>Caption</dc:description>
         <dc:subject>
            <rdf:Seq>
               <rdf:li>Keyword2</rdf:li>
               <rdf:li>Keyword1</rdf:li>
            </rdf:Seq>
         </dc:subject>
         <photoshop:DateCreated>2000-01-01T12:00:00+02:00</photoshop:DateCreated>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>


Or, as shown in exiftool:

exiftool -a -G1 -s movie_mp4.xmp
[ExifTool]      ExifToolVersion                 : 12.34
[System]        FileName                        : movie_mp4.xmp
[System]        Directory                       : .
[System]        FileSize                        : 1113 bytes
[System]        FileModifyDate                  : 2022:01:05 19:09:05+02:00
[System]        FileAccessDate                  : 2022:01:05 19:09:14+02:00
[System]        FileInodeChangeDate             : 2022:01:05 19:09:14+02:00
[System]        FilePermissions                 : -rw-r--r--
[File]          FileType                        : XMP
[File]          FileTypeExtension               : xmp
[File]          MIMEType                        : application/rdf+xml
[XMP-x]         XMPToolkit                      : XMP Core 6.0.0
[XMP-exif]      GPSLongitude                    : 70 deg 39' 1.68" E
[XMP-exif]      GPSLongitudeRef                 : W
[XMP-exif]      GPSHPositioningError            : 1 m
[XMP-exif]      GPSLatitude                     : 33 deg 27' 6.68" N
[XMP-exif]      GPSLatitudeRef                  : S
[XMP-exif]      GPSDateTime                     : 2022:01:05 16:56:46Z
[XMP-dc]        Title                           : Title
[XMP-dc]        Description                     : Caption
[XMP-dc]        Subject                         : Keyword2, Keyword1
[XMP-photoshop] DateCreated                     : 2000:01:01 12:00:00+02:00
[Composite]     GPSLatitudeRef                  : North
[Composite]     GPSLongitudeRef                 : East
[Composite]     GPSPosition                     : 33 deg 27' 6.68" N, 70 deg 39' 1.68" E


I can copy all updated .xmp sidecar Dates, Titles, Descriptions, and Keywords to the original .mp4, .m4v and .mov Keys and set the file dates with the following command so they are shown in QuickTime Player and Photos.app (they prefer Keys:DisplayName over Keys:Title. Keywords are not imported to Photos.app):

exiftool -overwrite_original_in_place -ext mp4 -ext m4v -ext mov -tagsFromFile %d%f.xmp -api QuickTimeUTC=1 '-QuickTime:CreateDate<XMP-photoshop:DateCreated' '-Keys:CreationDate<XMP-photoshop:DateCreated' '-Keys:DisplayName<XMP-dc:Title' '-Keys:Description<XMP-dc:Description' '-Keys:Keywords<XMP-dc:Subject' '-FileCreateDate<XMP-photoshop:DateCreated' '-FileModifyDate<XMP-photoshop:DateCreated' .

AFAIK Apple uses wrong format for the GPS references in .xmp, and the correct way should be:

<exif:GPSLatitude>36,36.36S</exif:GPSLatitude>
<exif:GPSLongitude>66,54.54W</exif:GPSLongitude>


-> Question: how can I bypass this flaw and copy the GPS to movies 'Keys:GPSCoordinates' with the correct references for western and southern hemispheres?

[Keys]          GPSCoordinates                  : 36 deg 36' 36.36" S, 66 deg 54' 54.54" W

p.s. I can successfully bypass the same flaw in .xmp sidecar to .jpg with:

exiftool -overwrite_original_in_place -ext jpg '-IPTC:CodedCharacterSet=UTF8' -tagsFromFile %d%f.xmp -@ xmp2exif.args '-GPS:GPSLatitudeRef<XMP:GPSLatitudeRef' '-GPS:GPSLongitudeRef<XMP:GPSLongitudeRef' -@ xmp2iptc.args '-XMP-photoshop:DateCreated<XMP-photoshop:DateCreated' '-FileCreateDate<XMP-photoshop:DateCreated' '-FileModifyDate<XMP-photoshop:DateCreated' .

...while with correct .xmp GPS references I could simply use:

exiftool -overwrite_original_in_place -ext jpg -tagsFromFile %d%f.xmp -@ xmp2exif.args -@ xmp2iptc.args '-all:all' '-FileCreateDate<XMP-photoshop:DateCreated' '-FileModifyDate<XMP-photoshop:DateCreated' .

https://exiftool.org/forum/index.php?topic=11969.0

- Matti

StarGeek

Quote from: wywh on January 05, 2022, 12:45:44 PM
-> Question: how can I bypass this flaw and copy the GPS to movies 'Keys:GPSCoordinates' with the correct references for western and southern hemispheres?

[Keys]          GPSCoordinates                  : 36 deg 36' 36.36" S, 66 deg 54' 54.54" W

You would use a variation of this example with a little alteration for GPSCoordinates

'-GPSCoordinates<$xmp:GPSLatitude# $xmp:GPSLatitudeRef $XMP:GPSLongitude# $xmp:GPSLongitudeRef'
* 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).

wywh

#2
Thanks for the hint. I unsuccessfully tried to modify my command with some variations to copy those flawed XMP-exif GPS tags correctly to Keys (which works better than ItemList and UserData):

ls
movie_mp4.mp4   movie_mp4.xmp

exiftool -a -G1 -s movie_mp4.xmp
[ExifTool]      ExifToolVersion                 : 12.34
[XMP-exif]      GPSLongitude                    : 70 deg 39' 1.68" E
[XMP-exif]      GPSLongitudeRef                 : W
[XMP-exif]      GPSLatitude                     : 33 deg 27' 6.68" N
[XMP-exif]      GPSLatitudeRef                  : S

exiftool --ext xmp -tagsfromfile %d%f.xmp '-GPSCoordinates<$XMP:GPSLatitude# $XMP:GPSLatitudeRef $XMP:GPSLongitude# $XMP:GPSLongitudeRef' .
Warning: No writable tags set from ./movie_mp4.xmp
    1 directories scanned
    0 image files updated
    1 image files unchanged

exiftool --ext xmp -tagsfromfile %d%f.xmp '-GPSCoordinates<$XMP-exif:GPSLatitude# $XMP-exif:GPSLatitudeRef $XMP-exif:GPSLongitude# $XMP-exif:GPSLongitudeRef' .
Warning: No writable tags set from ./movie_mp4.xmp
    1 directories scanned
    0 image files updated
    1 image files unchanged
   
exiftool --ext xmp -tagsfromfile %d%f.xmp '-Keys:GPSCoordinates<$XMP-exif:GPSLatitude# $XMP-exif:GPSLatitudeRef $XMP-exif:GPSLongitude# $XMP-exif:GPSLongitudeRef' .
Warning: No writable tags set from ./movie_mp4.xmp
    1 directories scanned
    0 image files updated
    1 image files unchanged


p.s. A year ago I sent feedback to Apple about this .xmp GPS reference flaw but it is not fixed yet and I am not holding my breath. I just sent another note about this to Apple.

- Matti

StarGeek

Oops, sorry, forgot that a comma is needed when writing GPSCoordinates
'-GPSCoordinates<$XMP:GPSLatitude# $XMP:GPSLatitudeRef, $XMP:GPSLongitude# $XMP:GPSLongitudeRef'

C:\>exiftool -G1 -a -s -xmp:all Y:\!temp\Test1.xmp
[XMP-x]         XMPToolkit                      : Image::ExifTool 12.38
[XMP-exif]      GPSLatitude                     : 33 deg 27' 6.68" N
[XMP-exif]      GPSLongitude                    : 70 deg 39' 1.68" E
[XMP-exif]      GPSLongitudeRef                 : W
[XMP-exif]      GPSLatitudeRef                  : S

C:\>exiftool -P -overwrite_original --ext xmp -tagsfromfile %d%f.xmp "-GPSCoordinates<$XMP:GPSLatitude# $XMP:GPSLatitudeRef, $XMP:GPSLongitude# $XMP:GPSLongitudeRef" Y:\!temp\Test1.mp4
    1 image files updated

C:\>exiftool -G1 -a -s -GPSCoordinates Y:\!temp\Test1.mp4
[ItemList]      GPSCoordinates                  : 33 deg 27' 6.68" S, 70 deg 39' 1.68" W
* 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).

wywh

#4
Thanks! Little things mean a lot.

I can copy all macOS 12 Monterey Photos 7.0 generated .xmp sidecar Dates, GPS, Titles, Descriptions, and Keywords to the original .mp4, .m4v and .mov Keys and also set the file dates with the following command so they are shown in QuickTime Player and Photos.app (they prefer Keys:DisplayName over Keys:Title. Keywords are not imported back to Photos.app, though. Unlike Final Cut Pro, Photos.app does not use Keys:Author so I omitted it here).

I used '-Keys:GPSCoordinates' because '-GPSCoordinates' defaults to ItemList instead Keys (which works better than corresponding ItemList and UserData tags).

exiftool -overwrite_original_in_place -api QuickTimeUTC=1 --ext xmp -tagsFromFile %d%f.xmp -api QuickTimeUTC=1 '-AllDates<XMP-photoshop:DateCreated' '-Track*Date<XMP-photoshop:DateCreated' '-Media*Date<XMP-photoshop:DateCreated' '-Keys:CreationDate<XMP-photoshop:DateCreated' '-Keys:GPSCoordinates<$XMP:GPSLatitude# $XMP:GPSLatitudeRef, $XMP:GPSLongitude# $XMP:GPSLongitudeRef' '-Keys:DisplayName<XMP-dc:Title' '-Keys:Description<XMP-dc:Description' '-Keys:Keywords<XMP-dc:Subject' '-FileCreateDate<XMP-photoshop:DateCreated' '-FileModifyDate<XMP-photoshop:DateCreated' .

That command bypasses the macOS 11-12 Big Sur and Monterey Photos.app 6.0-7.0 .xmp export flaw with GPS references:

<exif:GPSLatitude>36.610100000000003</exif:GPSLatitude>
<exif:GPSLatitudeRef>S</exif:GPSLatitudeRef>
<exif:GPSLongitude>66.915149999999997</exif:GPSLongitude>
<exif:GPSLongitudeRef>W</exif:GPSLongitudeRef>

...which should be:

<exif:GPSLatitude>36,36.36S</exif:GPSLatitude>
<exif:GPSLongitude>66,54.54W</exif:GPSLongitude>

- Matti

denkly

Hello! Your script is just what i was looking for, as im trying to do correct date created from iPhotos.
But scripts return error Warning: Error 256 running "/usr/bin/setfile" to set FileCreateDate

I'm a new one to ExifTool, installed on MacOS 13.4.1, cd to directory where files+xmp are and from there started the script. Any advice or help?

Thanks!

Phil Harvey

You need to install "setfile" on your MacOS system.  You can do it by typing this command:

xcode-select --install

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