Skip to content

Fix ffmpeg info parser to avoid unexpected metadata lose and type error in certain case. #2418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

toyaji
Copy link

@toyaji toyaji commented Apr 18, 2025

This is related to [#2311] and [#1860].

At first, I got a TypeError from flowing line for self._last_metadata_field_added was "displaymatrix" which is casted integer, then trying operate int + str. I can easily avoid this TypeError by type conversion or check if the last metadata field was catsted. But fundamentally, why this code try to concat the fields that are not multiple line metadata?

# multiline metadata value parsing
if field == "":
field = self._last_metadata_field_added
value = self._current_stream["metadata"][field] + "\n" + value

Then I found [#2311] caused this issue because changed code ignore none "key:value" metadata and return empty string "" as default. So above line is triggered which was intended to multiple line metadata concat.

So I think we need to handle none "key:value" metadata rather than not just ignoring them. Following keys are none "key:value" metadata I've just found in dump.c in ffmpeg original repo. And I want add them on parse_metadata_field_value() to parse properly.

  • Mastering Display Metadata,
  • Ambient Viewing Environment,
  • Content Light Level Metadata,

Additionally, I found for video stream there is sidedata besides metadata but currently parsed as metadata. So I separate sidedata from metadata for video stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant