Linebreaks and tabs to movie descriptions

Started by wywh, March 04, 2023, 05:31:06 AM

Previous topic - Next topic

wywh

How should linebreaks and tabs be typed to movie Keys:Description?

I can paste from a BBEdit text-only (styled text from LibreOffice works the same) the following to the macOS 13.2 Terminal with exiftool 12.50:

exiftool -overwrite_original -Keys:Description='One line break:
Two line breaks:

Umlauts åäöÅÄÖ and a dot .
Tabs between words' movie.mp4

...it is displayed in the Terminal as:

exiftool -a -G1 -s movie.mp4
[Keys]          Description                     : One line break:.Two line breaks:..Umlauts åäöÅÄÖ and a dot ..Tabs.between.words

...or more properly as:

exiftool -a -G1 -s -b -Keys:Description movie.mp4
One line break:
Two line breaks:

Umlauts åäöÅÄÖ and a dot .
Tabs between words

...macOS 13 Ventura QuickTime Player and Photos.app display them correctly in their original form and they can be correctly copied elsewhere.

-> Question: How should I type the command?

This does not work because the control characters are displayed as \n and \t in QuickTime Player and Photos.app. Using \\n or ${\} or ${/}gives a similar unwanted result:

exiftool -overwrite_original -Keys:Description='One line break:\nTwo line breaks:\n\nUmlauts åäöÅÄÖ and a dot .\nTabs\tbetween\twords' movie.mp4

[Keys]          Description                     : One line break:\nTwo line breaks:\n\nUmlauts åäöÅÄÖ and a dot .\nTabs\tbetween\twords%

- Matti

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

wywh

#2
Thanks! All these work in macOS 13 Ventura for linebreaks:

exiftool -ec -overwrite_original -Keys:Description='line 1\nline 2' movie.mp4

exiftool -E -overwrite_original -Keys:Description='line 1
line 2' movie.mp4

exiftool -fast3 -overwrite_original '-Keys:Description<line 1$/line 2' movie.mp4

This seems to be the easiest option for linebreaks and tabs:

exiftool -ec -overwrite_original -Keys:Description='One line break:\nTwo line breaks:\n\nUmlauts åäöÅÄÖ and a dot .\nTabs\tbetween\twords' movie.mp4
p.s. I usually use -overwrite_original_in_place so some macOS specific attributes are preserved. -overwrite_original might be just as good because it (surprisingly?) preserves Finder color tags and I do not care about other more obscure tags like "Hide extension".

- Matti

Phil Harvey

I am surprised that any finder tags would be preserved with -overwrite_original.  But then again, the MacOS filesystem is mysterious. :(

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