MediaArea / MediaInfoLib

Convenient unified display of the most relevant technical and tag data for video and audio files.
https://mediaarea.net/MediaInfo
BSD 2-Clause "Simplified" License
629 stars 171 forks source link

extra -> tagc does only contain one entry where multiple are set #1793

Closed ghost closed 1 year ago

ghost commented 1 year ago

Hello folks,

I'm using Subler to set metadata on my mediafiles. Subler offers me to either declare a Subtitle as Forced, Auxiliary content, hearing impaired etc. Using Mediainfo I can also see this metadata at extra -> tagc

{
"@type": "Text",
"@typeorder": "6",
"ID": "9",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5669.916",
"BitRate_Mode": "VBR",
"BitRate": "72",
"FrameRate": "0.453",
"FrameCount": "2567",
"StreamSize": "51184",
"Language": "en",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "UTC 2023-06-15 07:44:22",
"Tagged_Date": "UTC 2023-06-15 07:44:22",
"extra": {
"tagc": "public.accessibility.transcribes-spoken-dialog"
}
},

The problem here is that I can also set multiple values for a subtitle here using Subler, but mediainfo will only display one of them:

Screenshot 2023-06-15 105329

Can we please have all outputted ?

Thanks in advance

JeromeMartinez commented 1 year ago

A sample file withe all set, please.

ghost commented 1 year ago

Sure, I created a mp4 file only containing tx3g subtitles, also using Subler, then I attached all tabs of all subtitles as separate picture. Please obtain the zip archive here:

issue assets.zip

thanks for your Help :)

JeromeMartinez commented 1 year ago

@venomone please with the "Easy To Read" and "Language Translation" on 1 track, so I implement all in one shot.

ghost commented 1 year ago

No problem, I extended the test accordingly:

issue assets.zip

FYI. If I set "Easy To Read" and/or "Language Translation", the "Auxiliary Content" flag will also get selected automatically on Subler side, I have no influence onto this.

ghost commented 1 year ago

@JeromeMartinez Thanks again for your help, do you have any idea how long it takes to fix? I'm asking as this issue is currently quite a heavy blocker on my side.

Have a fine weekend :)

JeromeMartinez commented 1 year ago

@venomone sponsors have priority, but it is not a complicated issue, I try to fix that in the next days.

ghost commented 1 year ago

@JeromeMartinez It's not really clear to me how I can shift some money over to you from the page you send. I'm absolutely willing to get this solved asap, also for a donation, no question.

ghost commented 1 year ago

Do I simply have to become a member ?

JeromeMartinez commented 1 year ago

@venomone the page is more for bigger requests i.e. with a quote, a purchase order, and so on, all the "funny" paperworks with big companies. For small donations, we have a donation page for individuals.

ghost commented 1 year ago

@JeromeMartinez A donation of 100 USD has just been send ;) ... my Username is the same as on github "venomone". Hope you can solve this fast. Would be awesome if I can install the new version as usual using the MediaArea repos for Debian.

Have a fine day.

JeromeMartinez commented 1 year ago

Would be awesome if I can install the new version as usual using the MediaArea repos for Debian.

We have a repo for development snapshots on our repos page, or you can directly download the .deb on our dev snapshots. ... When it is ready.

About the support: despite a common UI in your screenshot, technically it is in different places e.g. forc atom for forced subtitles, tagc for others, I plan to map e.g. "Language Translation" to the field "Service Kind: Dubbed" (it won't be the exact string in the file, because we try to have common value in MediaInfo output for different formats) as we already do with DASH, and different services separated by " / ", but we keep force subtitles in their current "Forced" field, I hope it will be fine for you.

ghost commented 1 year ago

@JeromeMartinez I'm aware of this, for me, It's important that I can read the metadata from the Media Characteristics tab from Subler. As ffprobe is currently not able to read these (As they come originally from Apple's Core Media, I guess), I need mediaInfo to do this for me. In the end I generate two JSONs at my application, one by ffprobe, the other by mediainfo, then I merge some of the mediainfo JSON over to the ffprobe JSON as my Jobs are required to know what kind of subtitle get processed (Main Program, Forced, SDH or Auxiliary). So the Information I'm interested in from mediainfo JSON output are:

If multiple of these are set for a single subtitle, I also want to see this at the JSON output of mediainfo.

Thanks again

JeromeMartinez commented 1 year ago

"tagc": "public.accessibility.transcribes-spoken-dialog" -> Will become a SDH (hearing impaired) Subtitle on my Side

"HI" (hearing impaired) on our side.

"tagc": "public.main-program-content" -> Will become a main Program Subtitle on my Side

"CM" (complete main) on our side

"tagc": "public.subtitles.forced-only" -> Will become a Forced Subtitle on my Side

Forced field on our side

"tagc": "public.auxiliary-content" -> Will be used in the future on my side ;)

I think I'll discard this one, except if nothing else is used. As you indicated, it is mandatory if others are set, so redundant.

If multiple of these are set for a single subtitle, I also want to see this at the JSON output of mediainfo.

For the moment our output process does not support multiple JSON lines, you'll get values separated by " / " in 1 JSON field. You'll have to do some string processing there.

JeromeMartinez commented 1 year ago

I wonder about "Music and sound for accessibility", for this one I have not yet any name, nothing similar in AC-3 or DASH. "HI-ME"? (I have "ME" in AC-3 for "Music and Effects")

ghost commented 1 year ago

@JeromeMartinez "For the moment our output process does not support multiple JSON lines, you'll get values separated by " / " in 1 JSON field. You'll have to do some string processing there." -> No Problem, as long as it's JSON parsable.

"I think I'll discard this one, except if nothing else is used. As you indicated, it is mandatory if others are set, so redundant." -> Basically, yes, "public.auxiliary-content" can get dropped for the moment. I was just thinking about processing this kinda differently on my side, maybe for Director's comments or so, but even then, the term "auxiliary-content" might not really fit here, so yes, let's simply drop this.

JeromeMartinez commented 1 year ago

"public.auxiliary-content" can get dropped for the moment.

Will be mapped to "Supplementary" (DASH wording), if nothing else is available.

I hate that every entity has its own wording with different meaning!

ghost commented 1 year ago

I wonder about "Music and sound for accessibility", for this one I have not yet any name, nothing similar in AC-3 or DASH. "HI-ME"? (I have "ME" in AC-3 for "Music and Effects") -> I always set this together with "Transcribes Spoken Dialog For Accessibility", For me, both indicate SDH in the end.

JeromeMartinez commented 1 year ago

I always set this together with "Transcribes Spoken Dialog For Accessibility", For me, both indicate SDH in the end.

reason I use "HI" prefix, but as it has 2 different checkbox, better to split. But crazy option...

ghost commented 1 year ago

I hate that every entity has its own wording with different meaning! -> xD True ... But if you take a look at how many possible Metadata Atoms you can set, you might run out of names.

JeromeMartinez commented 1 year ago

In development snapshots (for Linux: libmediainfo0 package).

Note some difference compared to discussion yesterday. Service kind is "HI" if both items are checked, else "HI-ME" or "HI-D".

ghost commented 1 year ago

@JeromeMartinez The output is still buggy to me:

  1. Why are there Subtitles that don't have any service kind (See ID 1 for example)?
  2. "ServiceKind": "EasyReader / Translation", -> This is kinda ugly compared to the others you have now set (CM, HI).

My Suggestion. Why not simply have a dedicated flag for each of these, you already have forced as a dedicated flag, simply do the same for the others

Hearing Impaired: True/False Music_and_Effects: True/False EasyReader: True/False Translation: True/False Main_Content: True/False Forced: True/False Auxilary_Content: True/False

This would also make parsing much easier for me and would solve all my problems at once. Interpreting how the "combinement" of these are, should be up to the user. In the end these are just True/False Metadata, also at the mp4 track.

mediainfo --Output=JSON "/home/user123/test_inner_subtitle_metadata.m4v"
{
"creatingLibrary": {
"name": "MediaInfoLib",
"version": "23.04.20230616",
"url": "https://mediaarea.net/MediaInfo"
},
"media": {
"@ref": "/home/claris/test_inner_subtitle_metadata.m4v",
"track": [
{
"@type": "General",
"TextCount": "8",
"FileExtension": "m4v",
"Format": "MPEG-4",
"CodecID": "M4V ",
"CodecID_Compatible": "M4V /M4A /mp42/isom",
"FileSize": "784817",
"Duration": "5671.290",
"OverallBitRate_Mode": "VBR",
"OverallBitRate": "1107",
"StreamSize": "524365",
"HeaderSize": "261380",
"DataSize": "259461",
"FooterSize": "263976",
"IsStreamable": "No",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:22:55 UTC",
"File_Modified_Date": "2023-06-15 09:22:56 UTC",
"File_Modified_Date_Local": "2023-06-15 11:22:56"
},
{
"@type": "Text",
"@typeorder": "1",
"StreamOrder": "0",
"ID": "1",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5444.500",
"BitRate_Mode": "VBR",
"BitRate": "1",
"FrameRate": "0.010",
"FrameCount": "53",
"StreamSize": "1007",
"Language": "de",
"Default": "Yes",
"Forced": "Yes",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "26",
"extra": {
"Full_Alternative": "1",
"Forced_Alternative": "1"
}
},
{
"@type": "Text",
"@typeorder": "2",
"StreamOrder": "1",
"ID": "2",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5443.707",
"BitRate_Mode": "VBR",
"BitRate": "74",
"FrameRate": "0.434",
"FrameCount": "2363",
"StreamSize": "50295",
"Language": "de",
"ServiceKind": "CM",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "1181"
},
{
"@type": "Text",
"@typeorder": "3",
"StreamOrder": "2",
"ID": "3",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5671.290",
"BitRate_Mode": "VBR",
"BitRate": "2",
"FrameRate": "0.011",
"FrameCount": "63",
"StreamSize": "1257",
"Language": "en",
"Default": "No",
"Forced": "Yes",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "31",
"extra": {
"Full_Alternative": "3",
"Forced_Alternative": "3"
}
},
{
"@type": "Text",
"@typeorder": "4",
"StreamOrder": "3",
"ID": "4",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5669.915",
"BitRate_Mode": "VBR",
"BitRate": "72",
"FrameRate": "0.453",
"FrameCount": "2567",
"StreamSize": "51184",
"Language": "en",
"ServiceKind": "CM",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "1283"
},
{
"@type": "Text",
"@typeorder": "5",
"StreamOrder": "4",
"ID": "5",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5671.290",
"BitRate_Mode": "VBR",
"BitRate": "75",
"FrameRate": "0.439",
"FrameCount": "2491",
"StreamSize": "53334",
"Language": "fr",
"ServiceKind": "CM",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "1245"
},
{
"@type": "Text",
"@typeorder": "6",
"StreamOrder": "5",
"ID": "6",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5669.915",
"BitRate_Mode": "VBR",
"BitRate": "72",
"FrameRate": "0.453",
"FrameCount": "2567",
"StreamSize": "51184",
"Language": "en",
"ServiceKind": "HI",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "1283"
},
{
"@type": "Text",
"@typeorder": "7",
"StreamOrder": "6",
"ID": "7",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5669.915",
"BitRate_Mode": "VBR",
"BitRate": "72",
"FrameRate": "0.453",
"FrameCount": "2567",
"StreamSize": "51184",
"Language": "en",
"ServiceKind": "CM",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:01:25 UTC",
"Tagged_Date": "2023-06-15 09:01:25 UTC",
"Events_Total": "1283"
},
{
"@type": "Text",
"@typeorder": "8",
"StreamOrder": "7",
"ID": "8",
"Format": "Timed Text",
"MuxingMode": "sbtl",
"CodecID": "tx3g",
"Duration": "5444.500",
"BitRate_Mode": "VBR",
"BitRate": "1",
"FrameRate": "0.010",
"FrameCount": "53",
"StreamSize": "1007",
"Language": "de",
"ServiceKind": "EasyReader / Translation",
"Default": "No",
"Forced": "No",
"AlternateGroup": "2",
"Encoded_Date": "2023-06-15 09:22:49 UTC",
"Tagged_Date": "2023-06-15 09:22:49 UTC",
"Events_Total": "26"
}
]
}
}
JeromeMartinez commented 1 year ago

Why are there Subtitles that don't have any service kind (See ID 1 for example)?

They are forced subtitles and no other metadata, we have a "Forced" line for that.

"ServiceKind": "EasyReader / Translation", -> This is kinda ugly compared to the others you have now set (CM, HI).

I didn't find a better name for them. CM/HI/VI/etc are already well known (in e.g. AC-3) but there, no idea about a good acronym.

My Suggestion. Why not simply have a dedicated flag for each of these, you already have forced as a dedicated flag, simply do the same for the others

If I do that for all requests, the MediaInfo output would be endless. There is no "False" tip in the file, a string in tagc is present or not. What about a new tagc value? Currently it is just added to the list in service kind. We have a specific field for "Forced" because it is also in another part in MP4 and also available in other formats (and it is more technical, for the player to do something, other items are more information for selection), but here this is very specific stuff, if we add a dedicated field for such kind of item for all formats our field list will become long, and we actually try to avoid to expand it much.

This would also make parsing much easier for me

I understand that it requires more processing on your side, but I warned about what I would do, and we try to have a common interface not only for such information, without matching how a single entity wants to have their things displayed (as you said, "auxiliary content" is mandatory if other stuff is selected, redundant and only for this format, MediaInfo tries to avoid redundancy and such specific thing), and currently this is how we do with multiple values for a field. Not perfect but it works. We could change at some point about how to handle such corner cases but it would requires long term thoughts because it will break the compatibility and we need to think to all scenarios, not for now.

For peeking exactly a piece of metadata as in the file, with have MediaTrace (in text or XML, no JSON yet :( ):

mediainfo test_inner_subtitle_metadata.m4v --ParseSpeed=0 --Details=1 --Output=XML
[...]
        <block offset="523516" name="User Data" size="76">
            <block offset="523516" name="Header" size="8">
                <data offset="523516" name="Size">76</data>
                <data offset="523520" name="Name">udta</data>
            </block>
            <block offset="523524" name="tagc" info="tagc" size="32">
                <block offset="523524" name="Header" size="8">
                    <data offset="523524" name="Size">32</data>
                    <data offset="523528" name="Name">tagc</data>
                </block>
                <data offset="523532" name="Value">public.auxiliary-content</data>
            </block>
            <block offset="523556" name="tagc" info="tagc" size="36">
                <block offset="523556" name="Header" size="8">
                    <data offset="523556" name="Size">36</data>
                    <data offset="523560" name="Name">tagc</data>
                </block>
                <data offset="523564" name="Value">public.subtitles.forced-only</data>
            </block>
        </block>
        <block offset="523592" name="Track Reference" size="20">
            <block offset="523592" name="Header" size="8">
                <data offset="523592" name="Size">20</data>
                <data offset="523596" name="Name">tref</data>
            </block>
            <block offset="523600" name="Forced Subtitle Track" size="12">
                <block offset="523600" name="Header" size="8">
                    <data offset="523600" name="Size">12</data>
                    <data offset="523604" name="Name">forc</data>
                </block>
                <data offset="523608" name="track-ID">1</data>
            </block>
        </block>
    </block>
[...]
ghost commented 1 year ago

@JeromeMartinez We have a specific field for "Forced" because it is also in another part in MP4 and also available in other formats (and it is more technical, for the player to do something, other items are more information for selection), but here this is very specific stuff, if we add a dedicated field for such kind of item for all formats our field list will become long, and we actually try to avoid to expand it much. -> Then just output them if they are True or are existing, on AudioTracks/VideoTracks you don't have these as far as I know, at least not all, just as a suggestion, but I also don't know your tool as good as you do:

audio_track_example

What I still don't understand, using the test file we shared, also see output from above, take a look at ID6, it says "ServiceKind": "HI", why not HI-ME ???:

possibly_faulty_output

Besides, HI-MS, should be the correct name here I guess.

JeromeMartinez commented 1 year ago

Then just output them if they are True or are existing,

This is also a possibility, but not our choice for the moment, as we try to map to what it means for the user, and we currently see that as a "service kind" (used elsewhere). Again, our goal is not to show exactly as an entity wants and/or implement, but to have a common interface for several formats. "Forced" is in another part of the file (redundant even for the same entity...), other fields seem to be the same topic so same field in MediaInfo.

why not HI-ME

Service kind is "HI" if both items are checked, else "HI-ME" or "HI-D". We use "ME" (Music and Effects) and "D" (dialogue) suffixes because we took them from AC-3 years ago and it seems to be same purpose (but applied to subtitles). Again, our goal is not to match the UI of a specific entity with a specific format. Show me this interface for e.g. DASH for demonstrating that it is an interface common to more people than a single entity, and we could see that it is a common practice. In the meantime, this seems to be very specific to an entity and we don't want to focus too much on such interface.

ghost commented 1 year ago

Service kind is "HI" if both items are checked, else "HI-ME" or "HI-D". -> Ahhh... Okay. Then I previously misunderstood your Intentions here. And no, I don't have an Interface to show. But I'm pretty sure you already were aware of this ;)

I can now also confirm that this seems to be a working solution for me, even if it works a bit the other way around.

One last question, If I want to use the snapshot version, can I currently only do this by a manual installation of the deb packages ?

Currently, I do this to install mediainfo:

wget https://mediaarea.net/repo/deb/repo-mediaarea_1.0-21_all.deb &&  \
dpkg -i repo-mediaarea_1.0-21_all.deb && \
sudo apt-get update  && \
sudo apt-get install -y mediainfo && \

Thanks again for your support :)

JeromeMartinez commented 1 year ago

If it helps, I can add an option for outputting the exact value, 1 line per item.Just not the default.Would be useful?

ghost commented 1 year ago

@JeromeMartinez It would help, at least it would make it easier for me to parse it, and it's way more flexible at interpreting the metadata on my side.

JeromeMartinez commented 1 year ago

It would help, at least it would make it easier for me to parse it, and it's way more flexible at interpreting the metadata on my side.

mediainfo test_inner_subtitle_metadata.m4v --Verbosity=1 --Output=JSON
[...]
"udta_tagc_public_auxiliarycontent": "Yes",
"udta_tagc_public_subtitles_forcedonly": "Yes",
[...]
"udta_tagc_public_accessibility_describesmusicandsound": "Yes",
"udta_tagc_public_auxiliarycontent": "Yes",
"udta_tagc_public_accessibility_transcribesspokendialog": "Yes"
[...]

(no dot in JSON...) In next snapshot.

If I want to use the snapshot version, can I currently only do this by a manual installation of the deb packages ?

See "repo-MediaArea-snapshots-1.0-21.noarch.rpm" in Repos page.

ghost commented 1 year ago

Now with this I can definitely work now! Thank you very, very much for your help. Really appreciate it. Hope the donation helps, it was worth it :)