Inserting "Category" to an image

Started by tobisi, May 27, 2020, 04:31:06 PM

Previous topic - Next topic

tobisi

Hi,

I have been trying to insert a value to the "Category" field and I get the following message as response:

command: exiftool "-Category=sports" testImage.jpg

response:
Warning: [Minor] IPTC:Category exceeds length limit (truncated) - imageTest.jpg
    1 image files updated


The value will insert but the value shows as "spo".


Is there a way to extend the char length limitation?

Thank you!




StarGeek

From the docs on IPTC tags
    When writing, ExifTool issues a minor warning and truncates the value if it is longer than allowed by the IPTC specification. Minor errors may be ignored with the IgnoreMinorErrors (-m) option, allowing longer values to be written, but beware that values like this may cause problems for some other IPTC readers.

Though most modern software should be able to read it if the value is longer than the spec limit.

There is also the XMP:Category which does not have the character limit.
* 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).

tobisi

Thanks for the reply. I will test it out !

vibaulliETF

StarGeek,

Using ExifTool with mp4-files has caused some questions:
I have many old mp4-files which I'd like to convert to mp4 (with ffmpeg2 to reduce the space dramatically).
With ffmpeg2 I cannot transfer some metatags like "Category", so I tried to use ExifTool.
If I read the Exif Info of mp4-files with ExifTool I get this metatag listed with the correct value.
But if I try to write this tag with ExifTool to the transformed mp4-file, nothing happens.
Trying another tag, i.e. "Comment" works fine! I can read the correct value from the source file and apply it to the destination file successfully.
Is there something special with the metatag "Category"?

Ulli
Quote from: StarGeek on May 27, 2020, 04:41:31 PM
From the docs on IPTC tags
    When writing, ExifTool issues a minor warning and truncates the value if it is longer than allowed by the IPTC specification. Minor errors may be ignored with the IgnoreMinorErrors (-m) option, allowing longer values to be written, but beware that values like this may cause problems for some other IPTC readers.

Though most modern software should be able to read it if the value is longer than the spec limit.

There is also the XMP:Category which does not have the character limit.

StarGeek

Quote from: vibaulliETF on August 02, 2020, 04:49:04 PM
But if I try to write this tag with ExifTool to the transformed mp4-file, nothing happens.

What is the command you're using and what is the exact output.  Saying "nothing happens" doesn't provide any information in which to troubleshoot the problem.

This command works without any problems
C:\>exiftool -g1 -a -s -category="Category" C:\Users\Bryan\OneDrive\Test_Folder\Test1.mp4
    1 image files updated

C:\>exiftool -g1 -a -s -category C:\Users\Bryan\OneDrive\Test_Folder\Test1.mp4
---- ItemList ----
Category                        : Category
---- XMP-photoshop ----
Category                        : Category
* 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).

Phil Harvey

Make sure you are using a recent version of ExifTool because the MP4 writing capabilities are fairly new.

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

vibaulliETF

#6
Hi, StarGeek, Phil,

my version of exiftools is 12.03

preliminaries of my examples:
2 different video files:
file1: Source\Abschlepper.mp4
file2: Source\Verfolgungsrennen.mp4

the snapshot of the source directory with relevant tags: Before.jpg

I want to transform them with ffmpeg, using the commands:
ffmpeg -i Source\Abschlepper.mp4 Destination\Abschlepper.mp4
ffmpeg -i Source\Verfolgungsrennen.mp4 Destination\Verfolgungsrennen.mp4

the snapshot of the destination directory with relevant tags After.jpg

You can see, that the tag "Kommentare" is transferred correctly, the tag "Markieren" remains empty. (That I meant with "nothing happens")

Since the language of my operating system is German (like myself ;)) I'm using exiftool before to find out the tag names in English.
my commands are:
exiftool Source\Abschlepper.mp4 >SourceAbschlepper.txt
exiftool Source\Verfolgungsrennen.mp4 >SourceVerfolgungsrennen.txt

I can identify "Markieren" as "Category", and "Kommentare" as "Comment", exiftool reads my source values correct.

Then I use exiftool on the destination files
exiftool Destination\Abschlepper.mp4 >DestinationAbschlepper.txt
exiftool Destination\Verfolgungsrennen.mp4 >DestiantionVerfolgungsrennen.txt

It seems that my attempts to write with ffmpeg are not successful.
exiftool shows "Comment" with the correct values, and misses "Category" in both cases.
reason is probably that ffmpeg doesn't transform "Category" at all.

now I try setting the missing tag with the help of exiftool.
using the command:
exiftool -Category=Western destination\Abschlepp.mp4
Result:"1 image files updated"
But: still no Category value!

If I try another tag:
exiftool -Comment=Blubb destination\Abschlepp.mp4
Result: "1 image file updated"
And: Success!

That's all;)
Can you see a solution? Or is like you said "MP4 writing capabilties are fairly new."?
I hope my documentation illustrates my problem a bit;)

Ulli

Phil Harvey

Hi Ulli,

Quote from: vibaulliETF on August 04, 2020, 06:32:00 AM
You can see, that the tag "Kommentare" is transferred correctly, the tag "Markieren" remains empty. (That I meant with "nothing happens")

OK, but so far you haven't use ExifTool, right?

Quotemy commands are:
exiftool Source\Abschlepper.mp4 >SourceAbschlepper.txt
exiftool Source\Verfolgungsrennen.mp4 >SourceVerfolgungsrennen.txt

You should add -a -G1 to this command to see all tags and where they were stored.

Quotenow I try setting the missing tag with the help of exiftool.
That's all;)

...and the result was?  Could you read it back again with ExifTool?  Did you write it in the same location as the original?

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

vibaulliETF

Sorry, I recognised that I should have added this, but I edited my post just before your answer... hope you see the changes in between
;)
Ulli

StarGeek

Quote from: Phil Harvey on August 04, 2020, 07:51:00 AM
You should add -a -G1 to this command to see all tags and where they were stored.

I suspect you will find that the Category you're looking for will be a Microsoft Category tag, not a Quicktime tag.  Windows doesn't read many Quicktime tags.  I have a test file with about 130 Quicktime tags set and Windows will only show about 4-5 of them.

Very few of the Microsoft video tags can be written by any program.  MP3tag, despite it's name, is about the only program I've found that can write them.
* 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).

vibaulliETF

Well... since exiftool did not only read "Category" with the proper value from the MP4 file, I hoped, it would be able to write the same item, too.
I think it's nothing from MS, because it gets lost during transforming MP4 -> MP4 by ffmpeg, which is definitely no MS program;)
I don't use Linux, but I think the problem could be the same there.

Let me put my thoughts together:

if the value of Category in an MP4 file is not null, exiftool reads it correctly; but if it's lost (for example by the transforming via ffmpeg) then exiftool doesn't list this tag at all because it doesn't see it.
At least my attached .txt files suggest this.

Ulli

StarGeek

Quote from: vibaulliETF on August 04, 2020, 04:30:22 PM
Well... since exiftool did not only read "Category" with the proper value from the MP4 file, I hoped, it would be able to write the same item, too.

As per my link, there's a very long list of Microsoft Video tags that exiftool can read but cannot write.

QuoteI think it's nothing from MS, because it gets lost during transforming MP4 -> MP4 by ffmpeg, which is definitely no MS program;)

Unless you tell it otherwise, FFMpeg will strip away all embedded metadata.  And I don't believe it can write any of the Microsoft video tags, so those will always be stripped away even if you add the -map_metadata option.

Quoteif the value of Category in an MP4 file is not null, exiftool reads it correctly; but if it's lost (for example by the transforming via ffmpeg) then exiftool doesn't list this tag at all because it doesn't see it.

It doesn't see it because it's no longer there.  There's not an empty slot for where it should go.  It's completely gone.
* 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).

dae65

Quote from: vibaulliETF on August 04, 2020, 04:30:22 PM
Well... since exiftool did not only read "Category" with the proper value from the MP4 file, I hoped, it would be able to write the same item, too.
I'm not sure I understand the problem. See if this works:

Writing:
exiftool -ItemList:Category=Japan file.mp4

Reading:
exiftool -ItemList:Category file.mp4

StarGeek

Quote from: dae65 on August 04, 2020, 06:49:42 PM
I'm not sure I understand the problem. See if this works:

I believe the problem is that they're looking to copy the Category tag in Window. Markierenin their picture, Tags in English.  It's this listing in their attached text.
Category                        : Western




The tag that Windows is reading is the Microsoft:Category tag, which exiftool is cannot write.
C:\>exiftool -g1 -a -s -Category Y:\!temp\Test1.mp4
---- Microsoft ----
Category                        : tag, more tags


Windows doesn't read very many Quicktime tags, only QuickTime:Comment, QuickTime:Artist, QuickTime:ContentCreateDate, QuickTime:Genre, QuickTime:Composer, and QuickTime:DiskNumber according to my notes, but that data is probably over a year old. 
* 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).

vibaulliETF

Hi StarGeek, Phil,

from your link to "Microsoft Category Tags" I verified, that different than in this list, there ARE tags that can be written.
I tried "Comment" and "Title", both sucessfully.
In the list they are marked as "no".
Eventually I noticed that different than the values in "Comment" and "Title" (simple strings), "Category" has a multiple string type (separated by comma or semicolon), maybe that's the reason.
Whatever: I decided to transfer my "Category" values to the "Comment" metatag, so I can still get helpful views and filters from Windows Explorer.

Thank you very much for you patient support.
I'm just writing a program to re-tag all of my mp4 files... (could become a long night;)

Ulli