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.

343 lines
9.3KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle Libavfilter Documentation
  3. @titlepage
  4. @sp 7
  5. @center @titlefont{Libavfilter Documentation}
  6. @sp 3
  7. @end titlepage
  8. @chapter Introduction
  9. Libavfilter is the filtering API of FFmpeg. It is the substitute of the
  10. now deprecated 'vhooks' and started as a Google Summer of Code project.
  11. Integrating libavfilter into the main FFmpeg repository is a work in
  12. progress. If you wish to try the unfinished development code of
  13. libavfilter then check it out from the libavfilter repository into
  14. some directory of your choice by:
  15. @example
  16. svn checkout svn://svn.ffmpeg.org/soc/libavfilter
  17. @end example
  18. And then read the README file in the top directory to learn how to
  19. integrate it into ffmpeg and ffplay.
  20. But note that there may still be serious bugs in the code and its API
  21. and ABI should not be considered stable yet!
  22. @chapter Tutorial
  23. In libavfilter, it is possible for filters to have multiple inputs and
  24. multiple outputs.
  25. To illustrate the sorts of things that are possible, we can
  26. use a complex filter graph. For example, the following one:
  27. @example
  28. input --> split --> fifo -----------------------> overlay --> output
  29. | ^
  30. | |
  31. +------> fifo --> crop --> vflip --------+
  32. @end example
  33. splits the stream in two streams, sends one stream through the crop filter
  34. and the vflip filter before merging it back with the other stream by
  35. overlaying it on top. You can use the following command to achieve this:
  36. @example
  37. ./ffmpeg -i in.avi -s 240x320 -vf "[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2]
  38. @end example
  39. where input_video.avi has a vertical resolution of 480 pixels. The
  40. result will be that in output the top half of the video is mirrored
  41. onto the bottom half.
  42. Video filters are loaded using the @var{-vf} option passed to
  43. ffmpeg or to ffplay. Filters in the same linear chain are separated by
  44. commas. In our example, @var{split, fifo, overlay} are in one linear
  45. chain, and @var{fifo, crop, vflip} are in another. The points where
  46. the linear chains join are labeled by names enclosed in square
  47. brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic
  48. labels @var{[in]} and @var{[out]} are the points where video is input
  49. and output.
  50. Some filters take in input a list of parameters: they are specified
  51. after the filter name and an equal sign, and are separated each other
  52. by a semicolon.
  53. There exist so-called @var{source filters} that do not have a video
  54. input, and we expect in the future some @var{sink filters} that will
  55. not have video output.
  56. @chapter graph2dot
  57. The @file{graph2dot} program included in the FFmpeg @file{tools}
  58. directory can be used to parse a filter graph description and issue a
  59. corresponding textual representation in the dot language.
  60. Invoke the command:
  61. @example
  62. graph2dot -h
  63. @end example
  64. to see how to use @file{graph2dot}.
  65. You can then pass the dot description to the @file{dot} program (from
  66. the graphviz suite of programs) and obtain a graphical representation
  67. of the filter graph.
  68. For example the sequence of commands:
  69. @example
  70. echo @var{GRAPH_DESCRIPTION} | \
  71. tools/graph2dot -o graph.tmp && \
  72. dot -Tpng graph.tmp -o graph.png && \
  73. display graph.png
  74. @end example
  75. can be used to create and display an image representing the graph
  76. described by the @var{GRAPH_DESCRIPTION} string.
  77. @chapter Available video filters
  78. When you configure your FFmpeg build, you can disable any of the
  79. existing video filters.
  80. The configure output will show the video filters included in your
  81. build.
  82. Below is a description of the currently available video filters.
  83. @section crop
  84. Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
  85. @example
  86. ./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi
  87. @end example
  88. @var{x} and @var{y} specify the position of the top-left corner of the
  89. output (non-cropped) area.
  90. The default value of @var{x} and @var{y} is 0.
  91. The @var{width} and @var{height} parameters specify the width and height
  92. of the output (non-cropped) area.
  93. A value of 0 is interpreted as the maximum possible size contained in
  94. the area delimited by the top-left corner at position x:y.
  95. For example the parameters:
  96. @example
  97. "crop=100:100:0:0"
  98. @end example
  99. will delimit the rectangle with the top-left corner placed at position
  100. 100:100 and the right-bottom corner corresponding to the right-bottom
  101. corner of the input image.
  102. The default value of @var{width} and @var{height} is 0.
  103. @section format
  104. Convert the input video to one of the specified pixel formats.
  105. Libavfilter will try to pick one that is supported for the input to
  106. the next filter.
  107. The filter accepts a list of pixel format names, separated by ``:'',
  108. for example ``yuv420p:monow:rgb24''.
  109. The following command:
  110. @example
  111. ./ffmpeg -i in.avi -vf "format=yuv420p" out.avi
  112. @end example
  113. will convert the input video to the format ``yuv420p''.
  114. @section noformat
  115. Force libavfilter not to use any of the specified pixel formats for the
  116. input to the next filter.
  117. The filter accepts a list of pixel format names, separated by ``:'',
  118. for example ``yuv420p:monow:rgb24''.
  119. The following command:
  120. @example
  121. ./ffmpeg -i in.avi -vf "noformat=yuv420p, vflip" out.avi
  122. @end example
  123. will make libavfilter use a format different from ``yuv420p'' for the
  124. input to the vflip filter.
  125. @section null
  126. Pass the source unchanged to the output.
  127. @section pad
  128. Add paddings to the input image, and places the original input at the
  129. given coordinates @var{x}, @var{y}.
  130. It accepts the following parameters:
  131. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  132. Follows the description of the accepted parameters.
  133. @table @option
  134. @item width, height
  135. Specify the size of the output image with the paddings added. If the
  136. value for @var{width} or @var{height} is 0, the corresponding input size
  137. is used for the output.
  138. The default value of @var{width} and @var{height} is 0.
  139. @item x, y
  140. Specify the offsets where to place the input image in the padded area
  141. with respect to the top/left border of the output image.
  142. The default value of @var{x} and @var{y} is 0.
  143. @item color
  144. Specify the color of the padded area, it can be the name of a color
  145. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  146. The default value of @var{color} is ``black''.
  147. @end table
  148. @section scale
  149. Scale the input video to @var{width}:@var{height} and/or convert the image format.
  150. For example the command:
  151. @example
  152. ./ffmpeg -i in.avi -vf "scale=200:100" out.avi
  153. @end example
  154. will scale the input video to a size of 200x100.
  155. If the input image format is different from the format requested by
  156. the next filter, the scale filter will convert the input to the
  157. requested format.
  158. If the value for @var{width} or @var{height} is 0, the respective input
  159. size is used for the output.
  160. If the value for @var{width} or @var{height} is -1, the scale filter will
  161. use, for the respective output size, a value that maintains the aspect
  162. ratio of the input image.
  163. The default value of @var{width} and @var{height} is 0.
  164. @section slicify
  165. Pass the images of input video on to next video filter as multiple
  166. slices.
  167. @example
  168. ./ffmpeg -i in.avi -vf "slicify=32" out.avi
  169. @end example
  170. The filter accepts the slice height as parameter. If the parameter is
  171. not specified it will use the default value of 16.
  172. Adding this in the beginning of filter chains should make filtering
  173. faster due to better use of the memory cache.
  174. @section unsharp
  175. Sharpen or blur the input video. It accepts the following parameters:
  176. @multitable @columnfractions .2 .5 .1 .1 .1
  177. @headitem Name @tab Description @tab Min @tab Max @tab Default
  178. @item @var{luma_msize_x}
  179. @tab Luma matrix horizontal size
  180. @tab 3
  181. @tab 13
  182. @tab 5
  183. @item @var{luma_msize_y}
  184. @tab Luma matrix vertical size
  185. @tab 3
  186. @tab 13
  187. @tab 5
  188. @item @var{luma_amount}
  189. @tab Luma effect strength
  190. @tab -2.0
  191. @tab 5.0
  192. @tab 1.0
  193. @item @var{chroma_msize_x}
  194. @tab Chroma matrix horizontal size
  195. @tab 3
  196. @tab 13
  197. @tab 0
  198. @item @var{chroma_msize_y}
  199. @tab Chroma matrix vertical size
  200. @tab 3
  201. @tab 13
  202. @tab 0
  203. @item @var{chroma_amount}
  204. @tab Chroma effect strength
  205. @tab -2.0
  206. @tab 5.0
  207. @tab 0.0
  208. @end multitable
  209. Negative values for the amount will blur the input video, while positive
  210. values will sharpen. All parameters are optional and default to the
  211. equivalent of the string '5:5:1.0:0:0:0.0'.
  212. @example
  213. # Strong luma sharpen effect parameters
  214. unsharp=7:7:2.5
  215. # Strong blur of both luma and chroma parameters
  216. unsharp=7:7:-2:7:7:-2
  217. # Use the default values with @command{ffmpeg}
  218. ./ffmpeg -i in.avi -vf "unsharp" out.mp4
  219. @end example
  220. @section vflip
  221. Flip the input video vertically.
  222. @example
  223. ./ffmpeg -i in.avi -vf "vflip" out.avi
  224. @end example
  225. @chapter Available video sources
  226. Below is a description of the currently available video sources.
  227. @section nullsrc
  228. Null video source, never return images. It is mainly useful as a
  229. template and to be employed in analysis / debugging tools.
  230. It accepts as optional parameter a string of the form
  231. @var{width}:@var{height}, where @var{width} and @var{height} specify the size of
  232. the configured source.
  233. The default values of @var{width} and @var{height} are respectively 352
  234. and 288 (corresponding to the CIF size format).
  235. @chapter Available video sinks
  236. Below is a description of the currently available video sinks.
  237. @section nullsink
  238. Null video sink, do absolutely nothing with the input video. It is
  239. mainly useful as a template and to be employed in analysis / debugging
  240. tools.
  241. @bye