mediaforge - v2.2.0
    Preparing search index...

    Function escapeDrawtextValue

    • Escape a value for use inside a drawtext text= option.

      Unlike escapeFilterValue, %{...} expansions (e.g. %{pts_hms}, %{eif:t\:b}) are passed through untouched. Escaping a colon inside one turns %{eif:t%b} into %{eif\\:t%b}, which ffmpeg no longer evaluates as an expression - so the surrounding text is escaped and the expressions are not.

      Scanned with indexOf rather than /%\{[^}]*\}/g. That regex is quadratic: with no closing brace in the input, each of the many %{ positions rescans the rest of the string looking for }, so a 192 KB value took 36.8 seconds (CodeQL js/polynomial-redos). A single forward pass with indexOf is linear.

      An unterminated %{ is treated as ordinary text, since ffmpeg would not expand it either.

      Parameters

      • s: string

      Returns string