ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: trymeout on April 30, 2021, 05:09:26 PM

Title: Edit Category of MP4 file
Post by: trymeout on April 30, 2021, 05:09:26 PM
How do you edit the category metadata of a MP4 file?

Here is a same video which has the category set to "John Doe, Mary Doe"
https://ufile.io/0d52fc80
Title: Re: Edit Category of MP4 file
Post by: StarGeek on April 30, 2021, 05:31:45 PM
You would write to the Microsoft:Category tag.  It is a list type tag so everything is FAQ #17 (https://exiftool.org/faq.html#Q17) applies.

To replace the categories in your example video, which started with John Doe, Mary Doe
C:\>exiftool -P -overwrite_original -Microsoft:Category="Indiana Jones" -Microsoft:Category="Han Solo" Y:\!temp\dddd\ShortVideo.mp4
    1 image files updated

C:\>exiftool -g1 -a -s -Microsoft:Category Y:\!temp\dddd\ShortVideo.mp4
---- Microsoft ----
Category                        : Indiana Jones, Han Solo


To add categories without replacing
C:\>exiftool -P -overwrite_original -Microsoft:Category+="John Doe" -Microsoft:Category+="Mary Doe" Y:\!temp\dddd\ShortVideo.mp4
    1 image files updated

C:\>exiftool -g1 -a -s -Microsoft:Category Y:\!temp\dddd\ShortVideo.mp4
---- Microsoft ----
Category                        : Indiana Jones, Han Solo, John Doe, Mary Doe

Title: Re: Edit Category of MP4 file
Post by: trymeout on April 30, 2021, 05:46:51 PM
This is what I get as an output in the terminal with the first command you given me.

$exiftool -P -overwrite_original -Microsoft:Category="Indiana Jones" -Microsoft:Category="Han Solo" ShortVideo.mp4
Warning: Sorry, Microsoft:Category doesn't exist or isn't writable
Warning: Sorry, Microsoft:Category doesn't exist or isn't writable
Nothing to do.


I am on Linux Mint if that helps
Title: Re: Edit Category of MP4 file
Post by: StarGeek on April 30, 2021, 06:15:35 PM
The ability to write Microsoft tags was added in version 12.20 (https://exiftool.org/history.html#v12.20).  You'll need to update to a newer version.
Title: Re: Edit Category of MP4 file
Post by: trymeout on April 30, 2021, 07:37:54 PM
Darn, I will have to wait until exiftools is updated on my distro
Title: Re: Edit Category of MP4 file
Post by: trymeout on May 03, 2021, 04:38:26 PM
Wont this work also?

exiftool -P -overwrite_original -Microsoft:Category="Indiana Jones, Han Solo" ShortVideo.mp4


instead of using this.

exiftool -P -overwrite_original -Microsoft:Category="Indiana Jones" -Microsoft:Category="Han Solo" ShortVideo.mp4
Title: Re: Edit Category of MP4 file
Post by: StarGeek on May 03, 2021, 05:03:49 PM
No, that will make a single entry of
"Indiana Jones, Han Solo"
when what you want would be
Indiana Jones
Han Solo

Category is a list type tag, not a comma separated string.  Make sure and read the FAQ 17 I linked above.

A good visual example would be to look at the raw XMP of a list type tag, such as Subject
<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:subject>
   <rdf:Bag>
    <rdf:li>One</rdf:li>
    <rdf:li>Two</rdf:li>
   </rdf:Bag>
  </dc:subject>
</rdf:Description>
</rdf:RDF>


As you can see, the two keywords, "One" and "Two" are completely separate.  While Microsoft:Category doesn't use the same format as it's not XMP, the idea is the same.  Each entry is completely separate.
Title: Re: Edit Category of MP4 file
Post by: trymeout on May 03, 2021, 05:37:01 PM
Good to know, would this command delete the Category metadata fully from the file?

exiftool -P -overwrite_original -Microsoft:Category="" FILE.mp4
Title: Re: Edit Category of MP4 file
Post by: StarGeek on May 03, 2021, 06:05:54 PM
Quotes aren't needed, simply -Microsoft:Category= will do.
Title: Re: Edit Category of MP4 file
Post by: trymeout on May 03, 2021, 09:26:58 PM
Excellent, thank you for helping me again!