doc/filters: propose solutions to avoid shell escaping

Reference drawtext textfile option and ffmpeg -filter_complex_script
and -filter_script as possible solutions to avoid shell escaping.

Address issue:
http://trac.ffmpeg.org/ticket/9008
This commit is contained in:
Stefano Sabatini 2023-03-26 17:47:52 +02:00
parent 030b34eac9
commit 7792f53e5e
2 changed files with 19 additions and 5 deletions

View File

@ -769,6 +769,7 @@ syntax.
See the @ref{filter_complex_option,,-filter_complex option} if you See the @ref{filter_complex_option,,-filter_complex option} if you
want to create filtergraphs with multiple inputs and/or outputs. want to create filtergraphs with multiple inputs and/or outputs.
@anchor{filter_script option}
@item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream}) @item -filter_script[:@var{stream_specifier}] @var{filename} (@emph{output,per-stream})
This option is similar to @option{-filter}, the only difference is that its This option is similar to @option{-filter}, the only difference is that its
argument is the name of the file from which a filtergraph description is to be argument is the name of the file from which a filtergraph description is to be
@ -1978,6 +1979,7 @@ The default is the number of available CPUs.
Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or Define a complex filtergraph, i.e. one with arbitrary number of inputs and/or
outputs. Equivalent to @option{-filter_complex}. outputs. Equivalent to @option{-filter_complex}.
@anchor{filter_complex_script option}
@item -filter_complex_script @var{filename} (@emph{global}) @item -filter_complex_script @var{filename} (@emph{global})
This option is similar to @option{-filter_complex}, the only difference is that This option is similar to @option{-filter_complex}, the only difference is that
its argument is the name of the file from which a complex filtergraph its argument is the name of the file from which a complex filtergraph

View File

@ -282,6 +282,18 @@ previous string will finally result in:
-vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters" -vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
@end example @end example
In order to avoid cumbersome escaping when using a commandline tool accepting a
filter specification as input, it is advisable to avoid direct inclusion of the
filter or options specification in the shell.
For example, in case of the @ref{drawtext,,drawtext filter}, you might prefer to
use the @option{textfile} option in place of @option{text} to specify the text
to render.
When using the @command{ffmpeg} tool, you might consider to use the
@ref{filter_script option,,-filter_script option,ffmpeg} or
@ref{filter_complex_script option,,-filter_complex_script option,ffmpeg}.
@chapter Timeline editing @chapter Timeline editing
Some filters support a generic @option{enable} option. For the filters Some filters support a generic @option{enable} option. For the filters
@ -12359,11 +12371,11 @@ braces is a function name, possibly followed by arguments separated by ':'.
If the arguments contain special characters or delimiters (':' or '@}'), If the arguments contain special characters or delimiters (':' or '@}'),
they should be escaped. they should be escaped.
Note that they probably must also be escaped as the value for the Note that they probably must also be escaped as the value for the @option{text}
@option{text} option in the filter argument string and as the filter option in the filter argument string and as the filter argument in the
argument in the filtergraph description, and possibly also for the shell, filtergraph description, and possibly also for the shell, that makes up to four
that makes up to four levels of escaping; using a text file avoids these levels of escaping; using a text file with the @option{textfile} option avoids
problems. these problems.
The following functions are available: The following functions are available: