How to write character ' to Keys tags in macOS

Started by wywh, February 11, 2023, 12:35:41 PM

Previous topic - Next topic

wywh

In Mac apps and Google Maps I already have dates working in movies with:

-api QuickTimeUTC=1 -QuickTime:CreateDate='2001:01:01 12:00:00'
...or also to other date tags (this shortcut is really meant for images' 'DateTimeOriginal', 'CreateDate' and 'ModifyDate' so it adds some extra date tags unless '-wm w' option is used to prevent that):

-api QuickTimeUTC=1 -AllDates='2001:01:01 12:00:00'
...and additionally for movies before 1904-1970:

-Keys:CreationDate='1922:01:01 12:00:00+02:00'
...and for locations:

-Keys:GPSCoordinates='-36.6101, -66.91515, 119.9'
Keys seems to be the best tag for other movie metadata for Mac apps. ItemList is 2nd best and UserData works somewhat.

So I am finally slowly starting to add Title, Author, Description and Keywords to .mp4, .m4v and .mov movies from my spreadsheet memo with a command like:

exiftool -m -P -overwrite_original_in_place -Keys:DisplayName='Title' -Keys:Author='Author' -Keys:Description='Description' -Keys:Keywords='Keyword 1,Keyword 2' movie.mp4
-> Question: How should I escape character ' ? Or should I just use character ´ instead because otherwise in macOS 13.2 Ventura character ' causes trouble like:

exiftool -m -P -overwrite_original_in_place -Keys:Description='00:00 Music: Jan Hammer - Crockett's Theme.

03:00 Stevie Ray Vaughan and Double Trouble at "Rockpalast" Lorelei Festival in St. Goarshausen Germany, 25.8.1984: Voodoo Chile (Slight Return).' .
quote>

Umlauts and those line breaks seem to work OK. Also tabs seem to go through OK but I am not yet sure if I should replace them with spaces?

- Matti


StarGeek

On the Mac, I believe you can escape it with a backslash.

Alternatively, the way I do it is to use the -E (-escapeHTML) option and convert it to an HTML entity.  But then, I have an autohotkey script that will do the conversion for me.

C:\>exiftool -P -overwrite_original -E -Description="' "" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -Description y:\!temp\Test4.jpg
[XMP-dc]        Description                     : ' "
* 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

Backslash does not seem to work at least like this:

exiftool -m -P -overwrite_original_in_place -Keys:Description='Description\'s' .
quote>

But this works, thanks:

exiftool -m -P -overwrite_original_in_place -E -Keys:Description='Description's here' movie.mp4

exiftool -a -G1 -s -n -ee -Keys:all movie.mp4
[Keys]          Description                     : Description's here
[...]

But the easiest way seems to just replace the few ' characters with ´ character. I also avoid spaces in image and movie file names to make the Terminal commands easier.

- Matti

StarGeek

* 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
Quote from: StarGeek on February 11, 2023, 02:37:11 PMThis StackOverflow answer may have more options.

Thanks for the note! So this works so I might have to un-learn using just single quotes...:

exiftool -m -P -overwrite_original_in_place -Keys:Description="Description's here" movie.mp4
...and these work too:

exiftool -m -P -overwrite_original_in_place -Keys:Description='Description'"'"'s here' movie.mp4

exiftool -m -P -overwrite_original_in_place -Keys:Description=$'Description\'s here' movie.mp4

exiftool -m -P -overwrite_original_in_place -Keys:Description='Description'\''s here' movie.mp4

- Matti