You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

259 lines
5.1KB

  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 ntsc
  91. 720x480
  92. @item pal
  93. 720x576
  94. @item qntsc
  95. 352x240
  96. @item qpal
  97. 352x288
  98. @item sntsc
  99. 640x480
  100. @item spal
  101. 768x576
  102. @item film
  103. 352x240
  104. @item ntsc-film
  105. 352x240
  106. @item sqcif
  107. 128x96
  108. @item qcif
  109. 176x144
  110. @item cif
  111. 352x288
  112. @item 4cif
  113. 704x576
  114. @item 16cif
  115. 1408x1152
  116. @item qqvga
  117. 160x120
  118. @item qvga
  119. 320x240
  120. @item vga
  121. 640x480
  122. @item svga
  123. 800x600
  124. @item xga
  125. 1024x768
  126. @item uxga
  127. 1600x1200
  128. @item qxga
  129. 2048x1536
  130. @item sxga
  131. 1280x1024
  132. @item qsxga
  133. 2560x2048
  134. @item hsxga
  135. 5120x4096
  136. @item wvga
  137. 852x480
  138. @item wxga
  139. 1366x768
  140. @item wsxga
  141. 1600x1024
  142. @item wuxga
  143. 1920x1200
  144. @item woxga
  145. 2560x1600
  146. @item wqsxga
  147. 3200x2048
  148. @item wquxga
  149. 3840x2400
  150. @item whsxga
  151. 6400x4096
  152. @item whuxga
  153. 7680x4800
  154. @item cga
  155. 320x200
  156. @item ega
  157. 640x350
  158. @item hd480
  159. 852x480
  160. @item hd720
  161. 1280x720
  162. @item hd1080
  163. 1920x1080
  164. @item 2k
  165. 2048x1080
  166. @item 2kflat
  167. 1998x1080
  168. @item 2kscope
  169. 2048x858
  170. @item 4k
  171. 4096x2160
  172. @item 4kflat
  173. 3996x2160
  174. @item 4kscope
  175. 4096x1716
  176. @end table
  177. @anchor{video rate syntax}
  178. @section Video rate
  179. Specify the frame rate of a video, expressed as the number of frames
  180. generated per second. It has to be a string in the format
  181. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  182. number or a valid video frame rate abbreviation.
  183. The following abbreviations are recognized:
  184. @table @samp
  185. @item ntsc
  186. 30000/1001
  187. @item pal
  188. 25/1
  189. @item qntsc
  190. 30000/1001
  191. @item qpal
  192. 25/1
  193. @item sntsc
  194. 30000/1001
  195. @item spal
  196. 25/1
  197. @item film
  198. 24/1
  199. @item ntsc-film
  200. 24000/1001
  201. @end table
  202. @anchor{ratio syntax}
  203. @section Ratio
  204. A ratio can be expressed as an expression, or in the form
  205. @var{numerator}:@var{denominator}.
  206. Note that a ratio with infinite (1/0) or negative value is
  207. considered valid, so you should check on the returned value if you
  208. want to exclude those values.
  209. The undefined value can be expressed using the "0:0" string.
  210. @anchor{color syntax}
  211. @section Color
  212. It can be the name of a color (case insensitive match) or a
  213. [0x|#]RRGGBB[AA] sequence, possibly followed by "@@" and a string
  214. representing the alpha component.
  215. The alpha component may be a string composed by "0x" followed by an
  216. hexadecimal number or a decimal number between 0.0 and 1.0, which
  217. represents the opacity value (0x00/0.0 means completely transparent,
  218. 0xff/1.0 completely opaque).
  219. If the alpha component is not specified then 0xff is assumed.
  220. The string "random" will result in a random color.
  221. @c man end SYNTAX