exiftool does not sync MacOS:MDItem* tags in .m4v

Started by wywh, July 06, 2023, 12:13:07 PM

Previous topic - Next topic

wywh

I have added mainly Keys:Description and Keys:Keywords to .mp4, .m4v and .mov movies with exiftool 12.60 (and GraphicConverter 12).

macOS 13.4.1 Ventura QuickTime Player.app and Photos.app display them OK (as well as Keys:Title (overrided by Keys:DisplayName if it exists), Keys:GPSCoordinates, and Keys:CreationDate). Corresponding UserData or ItemList tags have a very limited support in those Apple's apps so currently I use only Keys.

macOS 13.4.1 Spotlight can find Keys: Description, Keywords, Author, and DisplayName in .mp4 and .mov.

BUT for some reason Spotlight fails in .m4v. Oddly enough, if just the .m4v suffix is changed to .mp4 or .mov, THEN Spotlight finds that metadata.

-> I now noticed that exiftool does not sync Keys:Description to MacOS:MDItemDescription in .m4v so Spotlight does not find that metadata like it does in .mp4. The same applies also to Keywords, Author, and DisplayName. In .mp4 and .mov they work as expected.

For example, Keys:Description added to otherwise similar .m4v and .mp4 in a same folder:

exiftool -overwrite_original -Keys:Description=qwerty_description .

exiftool -a -G1 -s -Keys:Description -MacOS:MDItemDescription .
======== ./movie.m4v
[Keys]          Description                     : qwerty_description
======== ./movie.mp4
[Keys]          Description                     : qwerty_description
[MacOS]         MDItemDescription               : qwerty_description

Apparently because of this Spotlight fails to find that description in .m4v while in .mp4 it works (Spotlight_fail.png).

On the other hand, Metamer.app can write those MacOS:MDItem* tags.

https://eclecticlight.co/xattred-sandstrip-xattr-tools/

Metamer.app is used to add MacOS:MDItemDescription=qwerty_description_metamer to the .m4v (Metamer.png):

exiftool -a -G1 -s -Keys:Description -MacOS:MDItemDescription .
======== ./movie.m4v
[Keys]          Description                     : qwerty_description
[MacOS]         MDItemDescription               : qwerty_description_metamer
======== ./movie.mp4
[Keys]          Description                     : qwerty_description
[MacOS]         MDItemDescription               : qwerty_description

After that Spotlight finds "qwerty_description" metadata also in .m4v (Spotlight_success.png).

...and of course then Spotlight finds "qwerty_description_metamer" only in .m4v (Spotlight_ MDItemDescription.png).

-> Why exiftool does not update those MDItem* tags in .m4v?

p.s. some related Spotlight info:

https://eclecticlight.co/2023/06/22/what-to-do-when-spotlight-cant-find-it/comment-page-1/?unapproved=87135&moderation-hash=23f44bc4ae22a3d47f3e8188cdbd9c6d#comment-87135

- Matti

StarGeek

Quote from: wywh on July 06, 2023, 12:13:07 PMBUT for some reason Spotlight fails in .m4v. Oddly enough, if just the .m4v suffix is changed to .mp4 or .mov, THEN Spotlight finds that metadata.

-> I now noticed that exiftool does not sync Keys:Description to MacOS:MDItemDescription in .m4v so Spotlight does not find that metadata like it does in .mp4. The same applies also to Keywords, Author, and DisplayName. In .mp4 and .mov they work as expected.

I could be wrong, but I don't believe exiftool syncs between Quicktime tags and the MacOS file system tags.  They are two different tags and the MDItem* and XAtt* tags require installing the associated command line programs in the first place.
* 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

Quote from: StarGeek on July 06, 2023, 01:13:48 PMI don't believe exiftool syncs between Quicktime tags and the MacOS file system tags

Yes, this might well be some macOS issue. I have Xcode 14.1 and its command line tools installed, if that matters.

- Matti

StarGeek

Do the tags sync up with the other file types?

If so, I'm inclined to believe that it is a property of the OS, though Phil will have to verify if exiftool is syncing the data.
* 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

Apparently macOS is automatically inserting MDItemDescription to .mp4 and .mov.

If Keys:Description exists, and I just rename .m4v to .mp4 or .mov, then MacOS:MDItemDescription appears (and Spotlight finds that metadata) -- and if I rename .mp4 or .mov to .m4v, then MDItemDescription disappears (and Spotlight does not find that metadata).

Spotlight can find ItemList:Title metadata in a .m4v. But not in .mp4 or .mov because MacOS:MDItemTitle is lacking there.

Spotlight can find UserData:Title in a .mov. But not in .mp4 or .m4v because MacOS:MDItemTitle is lacking there.

<sigh>

- Matti

wywh

It seems somehow .mp4 and .mov do not need XAttr extended attributes for Spotlight to work:

Spotlight finds Keys:Description tag with the aid of the automatically generated MDItemDescription in .mp4 and .mov without any XAttr extended attributes. After Keys:Description is added with exiftool, only MDItemDescription is automatically generated for .mp4 and .mov.

But for .m4v I must use xattred to create XAttrMDItemDescription. After that MDItemDescription is automatically generated and Spotlight finds that tag in .m4v.

Another option is to use Metamer.app to insert MDItemDescription -- I now noticed that it also adds that XAttrMDItemDescription.

If I delete XAttrMDItemDescription from .m4v, then MDItemDescription is automatically deleted and Spotlight does not find that tag in .m4v anymore.

So maybe a workaround for 3rd party tools like exiftool or GraphicConverter would be to sync XAttrMDItem* with Keys tags and let macOS automatically generate MDItem* for Description, Keywords, Authors, and Title at least for .m4v or maybe also for .mp4 and .mov?

I tried to copy those Keys tags to corresponding XAttrMDItem* tags but exiftool 12.60 can not yet write those MacOS:XAttrMDItem* tags (Description, Keywords, Authors, and Title).

- Matti

Phil Harvey

The MDItem tags are redundant information that the MacOS metadata worker reads out of the file and stores in a resource fork.  The synchronization between these and other tags depends on when the metadata worker scans the file.

I'm not sure how MacOS generates the XAttr tags, but probably with a similar process, and there appears to be some overlap with MDItem tags (the MacOS "mdls" and "xattr" utilities may be returning some of the same information).

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