ExifTool Forum

General => Metadata => Topic started by: wywh on March 04, 2023, 05:31:06 AM

Title: Linebreaks and tabs to movie descriptions
Post by: wywh on March 04, 2023, 05:31:06 AM
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
Title: Re: Linebreaks and tabs to movie descriptions
Post by: Phil Harvey on March 04, 2023, 07:02:54 AM
Hi Matti,

FAQ 21 (https://exiftool.org/faq.html#Q21) explains this in detail.

- Phil
Title: Re: Linebreaks and tabs to movie descriptions
Post by: wywh on March 04, 2023, 09:46:59 AM
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
Title: Re: Linebreaks and tabs to movie descriptions
Post by: Phil Harvey on March 04, 2023, 11:57:08 AM
I am surprised that any finder tags would be preserved with -overwrite_original.  But then again, the MacOS filesystem is mysterious. :(

- Phil