Getting Plex to read tags in MP4 files

Started by jacklail, January 23, 2024, 12:03:47 AM

Previous topic - Next topic

jacklail

I have been struggling to get Plex to read the metadata of my home video clips and stumbled on a solution that seems to work.

Plex says it reads a number of metadata fields, but for my "home videos" I am mostly interested in the fields labeled on Plex as "Title", "Summary" and "Date Released."

Plex's documentation says it reads "title," "description," and "year" and some others.

However, it's more specifically Quicktime "itemlist:title" for title and "itemlist:longdescription" for the "summary" field. If no sort title is specified, Plex seems to use itemlist:title.

However, when I added those or copied them from xmp-dc:title and xmp-dc:description, they wouldn't get picked up by the Plex scanner.

I also tested to no avail adding -api quicktimehandler=1 which has been suggested in some posts as something works with some Apple applications.

I was getting frustrated about this not working when I tried stripping the Quicktime tags first with -quicktime:all= and then running

exiftool '-itemlist:title<xmp-dc:title' '-itemlist:longdescription<xmp-dc:description' -year=YYYY -api QuickTimeHandler=1 file.mp4
... and Voila, it works!

I'm not sure why this works, but it does. Maybe Stargeek (who shares some notes on what Plex reads in another post) or Phil will have an explanation.

But if you have hit this wall with Exiftool and metadata for Plex video, give it a shot.

(Exiftool version 12.70 in a Debian container on a Chromebook.)



 

Phil Harvey

Could you upload a sample where you wrote the tags with ExifTool but they weren't recognized by Plex?

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

jacklail

Here's a new copy of one of the problematic files.

They may be specific to the video editor, LumaFusion.

Test file:

Dropbox link (downloadable)

It seems to write this Quicktime tag

Handler Type : Metadata Tags

while QuickTimeHandler=1 writes

Handler Type : Metadata

So I end up with two. I do not see a way to delete just the Quicktime:Handler tag before using QuickTimeHandler=1. I think your documentation shows the Handler tag is not normally writeable.

If only Quicktime:handler=Metadata exists, it seems to work. If both exist, it does not. If only Quicktime:handler=Metadata Tags exists, it does not work.

Here is the code I ran after running my regular video metadata script.

exiftool '-itemlist:title<xmp-dc:title' '-itemlist:longdescription<xmp-dc:description' -api QuickTimeHandler=1 -ext mp4 INPUT.mp4
Thanks so much for looking at this. It there a way for the api option Quicktimehandler to overwrite the existing handler tag instead of becoming a second entry?

Phil Harvey

#3
I got the sample, thanks.  There is definitely something odd with the way the tags are written.  Sorry, but it will be helpful to also have an original sample before ExifTool wrote anything.  I'm thinking that ExifTool should be throwing a warning and/or fixing files with this problem.

- Phil

Edit:  I had thought the file was missing a Meta container, but I just missed it with my text search, so I don't see anything wrong actually.

Edit2: I wonder what happens if you take the bad file and do a -keys:all= to it.  Does Plex then read the information you wrote?
...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 ($).

jacklail

I created another one. Here is the file as exported.

https://www.dropbox.com/scl/fi/gamxhsxjgvy9ye9l58qff/test-export.mp4?rlkey=rrrn0xjlvtz63y3p0t0nbxx3x&dl=0

I made a copy of it and added itemlist:title and itemlist:longdescription and they did not show up.


jacklail

Quote from: Phil Harvey on January 23, 2024, 02:50:11 PM-keys:all=

I made another copy from the file that did not work and did the above. It works.

Can you explain a little about what happens in -keys:all=

jacklail

I did not use the -api mediahandler=1 in these tests, but the Quicktime Handler Type is now Metadata instead of Metadata Tags.

Phil Harvey

Somehow it seems that Plex is ignoring the ItemList tags if Keys tags exist before the video handler.  I don't know why that should happen, but removing these seems to fix things.  The Keys group is just another place to store metadata in QuickTime-format videos.

I don't think the -api QuickTimeHandler option should be necessary.

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

jacklail

Thanks so much Phil for following me down the rabbit hole! :D Hopefully, it will help someone else.

Phil Harvey

#9
Glad to help.

Actually, QuickTimeHandler=1 is the default since ExifTool 12.19 (Feb 2021).  So setting this option makes no difference.

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