Skip to main content

Parameter Replacer

FFmpeg Builder: Parameter Replacer

The FFmpeg Builder: Parameter Replacer flow element modifies FFmpeg command-line parameters by applying configured string replacements.
It is useful for dynamically altering FFmpeg arguments during video processing flows, allowing flexible customization without changing the original command syntax manually.

This flow element scans the FFmpeg argument list and replaces matching keys with new parameters, supporting single or multiple values and even removal of parameters.


Purpose

FFmpeg commands can be complex and vary widely depending on the encoding scenario, source file, or target format.
Sometimes you need to programmatically adjust or override specific parameters to optimize encoding, fix incompatibilities, or apply user preferences.

This flow element enables such changes by applying a list of replacement rules to the FFmpeg arguments before execution, making your flows more adaptable and maintainable.


Replacements

A list of key-value pairs where:

  • The key is a sequence of one or more FFmpeg arguments to match exactly.
  • The value is the replacement string which can contain one or more parameters and values.

If the replacement value is empty, the matching parameter(s) are removed from the argument list.

The replacement engine:

  • Matches the key against the current argument list token sequence.
  • If matched, removes the key tokens and inserts the replacement tokens.
  • Supports multiple tokens in keys and values.
  • Logs replacements and removals for debugging.

Quotes in Replacements

  • The argument list tokens (the args list) should not include quotes around values unless those quotes are part of the actual parameter string.
  • When specifying keys and values in replacements, quotes may be included only to clarify grouping or when the FFmpeg parameter itself requires quotes (e.g., filter expressions).
  • The replacement engine splits keys and values by spaces into tokens, so any quotes included in the strings become part of the tokens.
  • Do not include quotes in keys or values if your actual FFmpeg arguments do not include them.
  • Use quotes in the replacement value only if FFmpeg expects the argument to be quoted or contains spaces that must be preserved as a single token.

Examples

KeyValueResulting Arguments
-preset medium-preset fastReplaces -preset medium with -preset fast
-filter_complex oldval-filter_complex "val1 val2"Replaces value with a single quoted token
-filter_complex oldval-filter_complex val1 val2Replaces value with two separate tokens val1 and val2
-map(empty)Removes the -map parameter entirely

For example, if your argument list contains:

-filter_complex somevalue

and your replacement key is

-filter_complex somevalue

without quotes, but your replacement value is

-filter_complex "new value"

(with quotes around "new value"), the quotes are used to group multiple words into a single argument token passed to FFmpeg, but the quotes themselves are not included in the actual argument value.


Outputs

  1. One or more parameter replacements or removals were applied.
  2. No replacements or removals were made.

Use Cases

🎛️ Customize Encoding Parameters
Easily swap presets, codecs, filters, or tuning parameters based on workflow conditions without rewriting entire command lines.

🔄 Adapt to Source or Destination Requirements
Change parameters dynamically to support different input formats, container restrictions, or streaming protocols.

🚫 Remove Unwanted Parameters
Strip out problematic or deprecated parameters on the fly without needing complex scripting.

🧪 Debug and Optimize Workflows
Trace what parameter replacements were made for troubleshooting or performance tuning.


Notes

  • The replacement keys and values are tokenized on spaces; do not include literal quotes in the argument list unless they are part of the parameter.
  • Use quotes in the replacement strings only if the underlying FFmpeg command expects them as part of a parameter.
  • The logger provides details on each replacement or removal for transparency.