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.

348 lines
9.0KB

  1. @chapter Video Filters
  2. @c man begin VIDEO FILTERS
  3. When you configure your FFmpeg build, you can disable any of the
  4. existing filters using --disable-filters.
  5. The configure output will show the video filters included in your
  6. build.
  7. Below is a description of the currently available video filters.
  8. @section crop
  9. Crop the input video to @var{x}:@var{y}:@var{width}:@var{height}.
  10. @example
  11. ./ffmpeg -i in.avi -vf "crop=0:0:0:240" out.avi
  12. @end example
  13. @var{x} and @var{y} specify the position of the top-left corner of the
  14. output (non-cropped) area.
  15. The default value of @var{x} and @var{y} is 0.
  16. The @var{width} and @var{height} parameters specify the width and height
  17. of the output (non-cropped) area.
  18. A value of 0 is interpreted as the maximum possible size contained in
  19. the area delimited by the top-left corner at position x:y.
  20. For example the parameters:
  21. @example
  22. "crop=100:100:0:0"
  23. @end example
  24. will delimit the rectangle with the top-left corner placed at position
  25. 100:100 and the right-bottom corner corresponding to the right-bottom
  26. corner of the input image.
  27. The default value of @var{width} and @var{height} is 0.
  28. @section format
  29. Convert the input video to one of the specified pixel formats.
  30. Libavfilter will try to pick one that is supported for the input to
  31. the next filter.
  32. The filter accepts a list of pixel format names, separated by ``:'',
  33. for example ``yuv420p:monow:rgb24''.
  34. The following command:
  35. @example
  36. ./ffmpeg -i in.avi -vf "format=yuv420p" out.avi
  37. @end example
  38. will convert the input video to the format ``yuv420p''.
  39. @section hflip
  40. Flip the input video horizontally.
  41. For example to horizontally flip the video in input with
  42. @file{ffmpeg}:
  43. @example
  44. ffmpeg -i in.avi -vf "hflip" out.avi
  45. @end example
  46. @section noformat
  47. Force libavfilter not to use any of the specified pixel formats for the
  48. input to the next filter.
  49. The filter accepts a list of pixel format names, separated by ``:'',
  50. for example ``yuv420p:monow:rgb24''.
  51. The following command:
  52. @example
  53. ./ffmpeg -i in.avi -vf "noformat=yuv420p, vflip" out.avi
  54. @end example
  55. will make libavfilter use a format different from ``yuv420p'' for the
  56. input to the vflip filter.
  57. @section null
  58. Pass the source unchanged to the output.
  59. @section pad
  60. Add paddings to the input image, and places the original input at the
  61. given coordinates @var{x}, @var{y}.
  62. It accepts the following parameters:
  63. @var{width}:@var{height}:@var{x}:@var{y}:@var{color}.
  64. Follows the description of the accepted parameters.
  65. @table @option
  66. @item width, height
  67. Specify the size of the output image with the paddings added. If the
  68. value for @var{width} or @var{height} is 0, the corresponding input size
  69. is used for the output.
  70. The default value of @var{width} and @var{height} is 0.
  71. @item x, y
  72. Specify the offsets where to place the input image in the padded area
  73. with respect to the top/left border of the output image.
  74. The default value of @var{x} and @var{y} is 0.
  75. @item color
  76. Specify the color of the padded area, it can be the name of a color
  77. (case insensitive match) or a 0xRRGGBB[AA] sequence.
  78. The default value of @var{color} is ``black''.
  79. @end table
  80. @section pixdesctest
  81. Pixel format descriptor test filter, mainly useful for internal
  82. testing. The output video should be equal to the input video.
  83. For example:
  84. @example
  85. format=monow, pixdesctest
  86. @end example
  87. can be used to test the monowhite pixel format descriptor definition.
  88. @section scale
  89. Scale the input video to @var{width}:@var{height} and/or convert the image format.
  90. For example the command:
  91. @example
  92. ./ffmpeg -i in.avi -vf "scale=200:100" out.avi
  93. @end example
  94. will scale the input video to a size of 200x100.
  95. If the input image format is different from the format requested by
  96. the next filter, the scale filter will convert the input to the
  97. requested format.
  98. If the value for @var{width} or @var{height} is 0, the respective input
  99. size is used for the output.
  100. If the value for @var{width} or @var{height} is -1, the scale filter will
  101. use, for the respective output size, a value that maintains the aspect
  102. ratio of the input image.
  103. The default value of @var{width} and @var{height} is 0.
  104. @section slicify
  105. Pass the images of input video on to next video filter as multiple
  106. slices.
  107. @example
  108. ./ffmpeg -i in.avi -vf "slicify=32" out.avi
  109. @end example
  110. The filter accepts the slice height as parameter. If the parameter is
  111. not specified it will use the default value of 16.
  112. Adding this in the beginning of filter chains should make filtering
  113. faster due to better use of the memory cache.
  114. @section unsharp
  115. Sharpen or blur the input video.
  116. It accepts the following parameters:
  117. @var{luma_msize_x}:@var{luma_msize_y}:@var{luma_amount}:@var{chroma_msize_x}:@var{chroma_msize_y}:@var{chroma_amount}
  118. Negative values for the amount will blur the input video, while positive
  119. values will sharpen. All parameters are optional and default to the
  120. equivalent of the string '5:5:1.0:0:0:0.0'.
  121. @table @option
  122. @item luma_msize_x
  123. Set the luma matrix horizontal size. It can be an integer between 3
  124. and 13, default value is 5.
  125. @item luma_msize_y
  126. Set the luma matrix vertical size. It can be an integer between 3
  127. and 13, default value is 5.
  128. @item luma_amount
  129. Set the luma effect strength. It can be a float number between -2.0
  130. and 5.0, default value is 1.0.
  131. @item chroma_msize_x
  132. Set the chroma matrix horizontal size. It can be an integer between 3
  133. and 13, default value is 0.
  134. @item chroma_msize_y
  135. Set the chroma matrix vertical size. It can be an integer between 3
  136. and 13, default value is 0.
  137. @item luma_amount
  138. Set the chroma effect strength. It can be a float number between -2.0
  139. and 5.0, default value is 0.0.
  140. @end table
  141. @example
  142. # Strong luma sharpen effect parameters
  143. unsharp=7:7:2.5
  144. # Strong blur of both luma and chroma parameters
  145. unsharp=7:7:-2:7:7:-2
  146. # Use the default values with @command{ffmpeg}
  147. ./ffmpeg -i in.avi -vf "unsharp" out.mp4
  148. @end example
  149. @section vflip
  150. Flip the input video vertically.
  151. @example
  152. ./ffmpeg -i in.avi -vf "vflip" out.avi
  153. @end example
  154. @c man end VIDEO FILTERS
  155. @chapter Video Sources
  156. @c man begin VIDEO SOURCES
  157. Below is a description of the currently available video sources.
  158. @section buffer
  159. Buffer video frames, and make them available to the filter chain.
  160. This source is mainly intended for a programmatic use, in particular
  161. through the interface defined in @file{libavfilter/vsrc_buffer.h}.
  162. It accepts the following parameters:
  163. @var{width}:@var{height}:@var{pix_fmt_string}
  164. All the parameters need to be explicitely defined.
  165. Follows the list of the accepted parameters.
  166. @table @option
  167. @item width, height
  168. Specify the width and height of the buffered video frames.
  169. @item pix_fmt_string
  170. A string representing the pixel format of the buffered video frames.
  171. It may be a number corresponding to a pixel format, or a pixel format
  172. name.
  173. @end table
  174. For example:
  175. @example
  176. buffer=320:240:yuv410p
  177. @end example
  178. will instruct the source to accept video frames with size 320x240 and
  179. with format "yuv410p". Since the pixel format with name "yuv410p"
  180. corresponds to the number 6 (check the enum PixelFormat definition in
  181. @file{libavutil/pixfmt.h}), this example corresponds to:
  182. @example
  183. buffer=320:240:6
  184. @end example
  185. @section color
  186. Provide an uniformly colored input.
  187. It accepts the following parameters:
  188. @var{color}:@var{frame_size}:@var{frame_rate}
  189. Follows the description of the accepted parameters.
  190. @table @option
  191. @item color
  192. Specify the color of the source. It can be the name of a color (case
  193. insensitive match) or a 0xRRGGBB[AA] sequence, possibly followed by an
  194. alpha specifier. The default value is "black".
  195. @item frame_size
  196. Specify the size of the sourced video, it may be a string of the form
  197. @var{width}x@var{heigth}, or the name of a size abbreviation. The
  198. default value is "320x240".
  199. @item frame_rate
  200. Specify the frame rate of the sourced video, as the number of frames
  201. generated per second. It has to be a string in the format
  202. @var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
  203. number or a valid video frame rate abbreviation. The default value is
  204. "25".
  205. @end table
  206. For example the following graph description will generate a red source
  207. with an opacity of 0.2, with size "qcif" and a frame rate of 10
  208. frames per second, which will be overlayed over the source connected
  209. to the pad with identifier "in".
  210. @example
  211. "color=red@@0.2:qcif:10 [color]; [in][color] overlay [out]"
  212. @end example
  213. @section nullsrc
  214. Null video source, never return images. It is mainly useful as a
  215. template and to be employed in analysis / debugging tools.
  216. It accepts as optional parameter a string of the form
  217. @var{width}:@var{height}, where @var{width} and @var{height} specify the size of
  218. the configured source.
  219. The default values of @var{width} and @var{height} are respectively 352
  220. and 288 (corresponding to the CIF size format).
  221. @c man end VIDEO SOURCES
  222. @chapter Video Sinks
  223. @c man begin VIDEO SINKS
  224. Below is a description of the currently available video sinks.
  225. @section nullsink
  226. Null video sink, do absolutely nothing with the input video. It is
  227. mainly useful as a template and to be employed in analysis / debugging
  228. tools.
  229. @c man end VIDEO SINKS