[FFmpeg-cvslog] doc/filters: add "Notes on filtergraph escaping" section
Stefano Sabatini
git at videolan.org
Thu Nov 1 11:53:09 CET 2012
ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Oct 30 22:02:29 2012 +0100| [14f1fa56b2aef1f4b2036ebdc7c6665ef68052c0] | committer: Stefano Sabatini
doc/filters: add "Notes on filtergraph escaping" section
Should help to clarify escaping issues in the filtergraph syntax. In
particular, should address trac ticket #1813.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14f1fa56b2aef1f4b2036ebdc7c6665ef68052c0
---
doc/filters.texi | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/doc/filters.texi b/doc/filters.texi
index 786b2db..eaf0f42 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -191,6 +191,59 @@ Follows a BNF description for the filtergraph syntax:
@var{FILTERGRAPH} ::= [sws_flags=@var{flags};] @var{FILTERCHAIN} [;@var{FILTERGRAPH}]
@end example
+ at section Notes on filtergraph escaping
+
+Some filter arguments require the use of special characters, typically
+ at code{:} to separate key=value pairs in a named options list. In this
+case the user should perform a first level escaping when specifying
+the filter arguments. For example, consider the following literal
+string to be embedded in the @ref{drawtext} filter arguments:
+ at example
+this is a 'string': may contain one, or more, special characters
+ at end example
+
+Since @code{:} is special for the filter arguments syntax, it needs to
+be escaped, so you get:
+ at example
+text=this is a \'string\'\: may contain one, or more, special characters
+ at end example
+
+A second level of escaping is required when embedding the filter
+arguments in a filtergraph description, in order to escape all the
+filtergraph special characters. Thus the example above becomes:
+ at example
+drawtext=text=this is a \\\'string\\\'\\: may contain one\, or more\, special characters
+ at end example
+
+Finally an additional level of escaping may be needed when writing the
+filtergraph description in a shell command, which depends on the
+escaping rules of the adopted shell. For example, assuming that
+ at code{\} is special and needs to be escaped with another @code{\}, the
+previous string will finally result in:
+ at example
+-vf "drawtext=text=this is a \\\\\\'string\\\\\\'\\\\: may contain one\\, or more\\, special characters"
+ at end example
+
+Sometimes, it might be more convenient to employ quoting in place of
+escaping. For example the string:
+ at example
+Caesar: tu quoque, Brute, fili mi
+ at end example
+
+Can be quoted in the filter arguments as:
+ at example
+text='Caesar: tu quoque, Brute, fili mi'
+ at end example
+
+And finally inserted in a filtergraph like:
+ at example
+drawtext=text=\'Caesar: tu quoque\, Brute\, fili mi\'
+ at end example
+
+See the @ref{quoting_and_escaping, Quoting and escaping} section for
+more information about the escaping and quoting rules adopted by
+FFmpeg.
+
@c man end FILTERGRAPH DESCRIPTION
@chapter Audio Filters
@@ -1782,6 +1835,7 @@ drawbox=x=10:y=10:w=100:h=100:color=pink@@0.5:t=max
@end example
@end itemize
+ at anchor{drawtext}
@section drawtext
Draw text string or text from specified file on top of video using the
More information about the ffmpeg-cvslog
mailing list