Skip to content
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

Flow Plugin - RemoveStreamByProperty: Codec-Type Filtering & Fix for 'not_includes #790

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

Conversation

pavax
Copy link

@pavax pavax commented Mar 2, 2025

Problem 1:
I have extended the RemoveStreamByProperty FlowPlugin to allow specifying the codec type (audio, video, or any).

The new default value for the new property is set to any so that my change is backwards compatible.

Use Case:
In my workflow, I need to ensure that audio streams matching a specific language property are removed before encoding them. Previously, the plugin would also remove video streams if their language matched, which was unintended. This update ensures only the specified codec type is affected.

Problem 2:
I also fixed an issue when using the not_includes option.

Example Scenario:

Consider the following audio tracks:

  • Track 1: en
  • Track 2: de
  • Track 3: it

Plugin Configuration:

  • Condition: not_includes
  • Property to check: tags.language
  • Values to remove: de, en, ger, eng, und

Expected Result:

  • Track 3 (it) should be removed because it does not match any of the specified values.

Current (Bugged) Behavior:

  • Instead of removing only Track 3, all streams are removed.
Root Cause:

The issue occurs because the code incorrectly iterates over each "value to remove" individually. If a single value does not match the property, the stream is immediately marked for removal, leading to unintended removals.

My Fix:

My fix changes this so that the plugins behave as follows:

  • For includes → Remove the stream if the "Property to check" contains ANY of the "values to remove".
  • For not_includes → Remove the stream if the "Property to check" contains NONE of the "values to remove".

Additionally, my fix improves the logging, so that not multiple logs are printed for multiple values and improves the iteration-efficiency a bit as I use the .some() method which stops as soon as a match was found.

@pavax pavax changed the title Flow Plugin - RemoveStreamByProperty: extend to filter by codec_type and fix issue with condition "not_includes" Flow Plugin - RemoveStreamByProperty: Codec-Type Filtering & Fix for 'not_includes Mar 2, 2025
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