libavfilter.texi 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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 -vfilters "[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{-vfilters} 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 Available video filters
  57. When you configure your FFmpeg build, you can disable any of the
  58. existing video filters.
  59. The configure output will show the video filters included in your
  60. build.
  61. Below is a description of the currently available video filters.
  62. @section crop
  63. Crop the input video to x:y:width:height.
  64. @example
  65. ./ffmpeg -i in.avi -vfilters "crop=0:0:0:240" out.avi
  66. @end example
  67. ``x'' and ``y'' specify the position of the top-left corner of the
  68. output (non-cropped) area.
  69. The default value of ``x'' and ``y'' is 0.
  70. The ``width'' and ``height'' parameters specify the width and height
  71. of the output (non-cropped) area.
  72. A value of 0 is interpreted as the maximum possible size contained in
  73. the area delimited by the top-left corner at position x:y.
  74. For example the parameters:
  75. @example
  76. "crop=100:100:0:0"
  77. @end example
  78. will delimit the rectangle with the top-left corner placed at position
  79. 100:100 and the right-bottom corner corresponding to the right-bottom
  80. corner of the input image.
  81. The default value of ``width'' and ``height'' is 0.
  82. @section format
  83. Convert the input video to one of the specified pixel formats.
  84. Libavfilter will try to pick one that is supported for the input to
  85. the next filter.
  86. The filter accepts a list of pixel format names, separated by ``:'',
  87. for example ``yuv420p:monow:rgb24''.
  88. The following command:
  89. @example
  90. ./ffmpeg -i in.avi -vfilters "format=yuv420p" out.avi
  91. @end example
  92. will convert the input video to the format ``yuv420p''.
  93. @section noformat
  94. Force libavfilter not to use any of the specified pixel formats for the
  95. input to the next filter.
  96. The filter accepts a list of pixel format names, separated by ``:'',
  97. for example ``yuv420p:monow:rgb24''.
  98. The following command:
  99. @example
  100. ./ffmpeg -i in.avi -vfilters "noformat=yuv420p, vflip" out.avi
  101. @end example
  102. will make libavfilter use a format different from ``yuv420p'' for the
  103. input to the vflip filter.
  104. @section null
  105. Pass the source unchanged to the output.
  106. @section scale
  107. Scale the input video to width:height and/or convert the image format.
  108. For example the command:
  109. @example
  110. ./ffmpeg -i in.avi -vfilters "scale=200:100" out.avi
  111. @end example
  112. will scale the input video to a size of 200x100.
  113. If the input image format is different from the format requested by
  114. the next filter, the scale filter will convert the input to the
  115. requested format.
  116. If the value for ``width'' or ``height'' is 0, the respective input
  117. size is used for the output.
  118. If the value for ``width'' or ``height'' is -1, the scale filter will
  119. use, for the respective output size, a value that maintains the aspect
  120. ratio of the input image.
  121. The default value of ``width'' and ``height'' is 0.
  122. @section slicify
  123. Pass the images of input video on to next video filter as multiple
  124. slices.
  125. @example
  126. ./ffmpeg -i in.avi -vfilters "slicify=32" out.avi
  127. @end example
  128. The filter accepts the slice height as parameter. If the parameter is
  129. not specified it will use the default value of 16.
  130. Adding this in the beginning of filter chains should make filtering
  131. faster due to better use of the memory cache.
  132. @section vflip
  133. Flip the input video vertically.
  134. @example
  135. ./ffmpeg -i in.avi -vfilters "vflip" out.avi
  136. @end example
  137. @bye