syntax.texi 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. @chapter Syntax
  2. @c man begin SYNTAX
  3. This section documents the syntax and formats employed by the FFmpeg
  4. libraries and tools.
  5. @anchor{quoting_and_escaping}
  6. @section Quoting and escaping
  7. FFmpeg adopts the following quoting and escaping mechanism, unless
  8. explicitly specified. The following rules are applied:
  9. @itemize
  10. @item
  11. @code{'} and @code{\} are special characters (respectively used for
  12. quoting and escaping). In addition to them, there might be other
  13. special characters depending on the specific syntax where the escaping
  14. and quoting are employed.
  15. @item
  16. A special character is escaped by prefixing it with a '\'.
  17. @item
  18. All characters enclosed between '' are included literally in the
  19. parsed string. The quote character @code{'} itself cannot be quoted,
  20. so you may need to close the quote and escape it.
  21. @item
  22. Leading and trailing whitespaces, unless escaped or quoted, are
  23. removed from the parsed string.
  24. @end itemize
  25. Note that you may need to add a second level of escaping when using
  26. the command line or a script, which depends on the syntax of the
  27. adopted shell language.
  28. The function @code{av_get_token} defined in
  29. @file{libavutil/avstring.h} can be used to parse a token quoted or
  30. escaped according to the rules defined above.
  31. The tool @file{tools/ffescape} in the FFmpeg source tree can be used
  32. to automatically quote or escape a string in a script.
  33. @subsection Examples
  34. @itemize
  35. @item
  36. Escape the string @code{Crime d'Amour} containing the @code{'} special
  37. character:
  38. @example
  39. Crime d\'Amour
  40. @end example
  41. @item
  42. The string above contains a quote, so the @code{'} needs to be escaped
  43. when quoting it:
  44. @example
  45. 'Crime d'\''Amour'
  46. @end example
  47. @item
  48. Include leading or trailing whitespaces using quoting:
  49. @example
  50. ' this string starts and ends with whitespaces '
  51. @end example
  52. @item
  53. Escaping and quoting can be mixed together:
  54. @example
  55. ' The string '\'string\'' is a string '
  56. @end example
  57. @item
  58. To include a literal @code{\} you can use either escaping or quoting:
  59. @example
  60. 'c:\foo' can be written as c:\\foo
  61. @end example
  62. @end itemize
  63. @anchor{date syntax}
  64. @section Date
  65. The accepted syntax is:
  66. @example
  67. [(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]
  68. now
  69. @end example
  70. If the value is "now" it takes the current time.
  71. Time is local time unless Z is appended, in which case it is
  72. interpreted as UTC.
  73. If the year-month-day part is not specified it takes the current
  74. year-month-day.
  75. @anchor{time duration syntax}
  76. @section Time duration
  77. The accepted syntax is:
  78. @example
  79. [-]HH:MM:SS[.m...]
  80. [-]S+[.m...]
  81. @end example
  82. @var{HH} expresses the number of hours, @var{MM} the number a of minutes
  83. and @var{SS} the number of seconds.
  84. @anchor{video size syntax}
  85. @section Video size
  86. Specify the size of the sourced video, it may be a string of the form
  87. @var{width}x@var{height}, or the name of a size abbreviation.
  88. The following abbreviations are recognized:
  89. @table @samp
  90. @item sqcif
  91. 128x96
  92. @item qcif
  93. 176x144
  94. @item cif
  95. 352x288
  96. @item 4cif
  97. 704x576
  98. @item 16cif
  99. 1408x1152
  100. @item qqvga
  101. 160x120
  102. @item qvga
  103. 320x240
  104. @item vga
  105. 640x480
  106. @item svga
  107. 800x600
  108. @item xga
  109. 1024x768
  110. @item uxga
  111. 1600x1200
  112. @item qxga
  113. 2048x1536
  114. @item sxga
  115. 1280x1024
  116. @item qsxga
  117. 2560x2048
  118. @item hsxga
  119. 5120x4096
  120. @item wvga
  121. 852x480
  122. @item wxga
  123. 1366x768
  124. @item wsxga
  125. 1600x1024
  126. @item wuxga
  127. 1920x1200
  128. @item woxga
  129. 2560x1600
  130. @item wqsxga
  131. 3200x2048
  132. @item wquxga
  133. 3840x2400
  134. @item whsxga
  135. 6400x4096
  136. @item whuxga
  137. 7680x4800
  138. @item cga
  139. 320x200
  140. @item ega
  141. 640x350
  142. @item hd480
  143. 852x480
  144. @item hd720
  145. 1280x720
  146. @item hd1080
  147. 1920x1080
  148. @end table
  149. @anchor{video rate syntax}
  150. @section Video rate
  151. Specify the frame rate of a video, expressed as the number of frames
  152. generated per second. It has to be a string in the format
  153. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  154. number or a valid video frame rate abbreviation.
  155. The following abbreviations are recognized:
  156. @table @samp
  157. @item ntsc
  158. 30000/1001
  159. @item pal
  160. 25/1
  161. @item qntsc
  162. 30000/1
  163. @item qpal
  164. 25/1
  165. @item sntsc
  166. 30000/1
  167. @item spal
  168. 25/1
  169. @item film
  170. 24/1
  171. @item ntsc-film
  172. 24000/1
  173. @end table
  174. @anchor{ratio syntax}
  175. @section Ratio
  176. A ratio can be expressed as an expression, or in the form
  177. @var{numerator}:@var{denominator}.
  178. Note that a ratio with infinite (1/0) or negative value is
  179. considered valid, so you should check on the returned value if you
  180. want to exclude those values.
  181. The undefined value can be expressed using the "0:0" string.
  182. @anchor{color syntax}
  183. @section Color
  184. It can be the name of a color (case insensitive match) or a
  185. [0x|#]RRGGBB[AA] sequence, possibly followed by "@@" and a string
  186. representing the alpha component.
  187. The alpha component may be a string composed by "0x" followed by an
  188. hexadecimal number or a decimal number between 0.0 and 1.0, which
  189. represents the opacity value (0x00/0.0 means completely transparent,
  190. 0xff/1.0 completely opaque).
  191. If the alpha component is not specified then 0xff is assumed.
  192. The string "random" will result in a random color.
  193. @c man end SYNTAX