libavfilter.texi 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. \input texinfo @c -*- texinfo -*-
  2. @settitle Libavfilter Documentation
  3. @titlepage
  4. @center @titlefont{Libavfilter Documentation}
  5. @end titlepage
  6. @top
  7. @contents
  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. Audio filtering integration into the main FFmpeg repository is a work in
  12. progress, so audio API and ABI should not be considered stable yet.
  13. @chapter Tutorial
  14. In libavfilter, it is possible for filters to have multiple inputs and
  15. multiple outputs.
  16. To illustrate the sorts of things that are possible, we can
  17. use a complex filter graph. For example, the following one:
  18. @example
  19. input --> split --> fifo -----------------------> overlay --> output
  20. | ^
  21. | |
  22. +------> fifo --> crop --> vflip --------+
  23. @end example
  24. splits the stream in two streams, sends one stream through the crop filter
  25. and the vflip filter before merging it back with the other stream by
  26. overlaying it on top. You can use the following command to achieve this:
  27. @example
  28. ffmpeg -i input -vf "[in] split [T1], fifo, [T2] overlay=0:H/2 [out]; [T1] fifo, crop=iw:ih/2:0:ih/2, vflip [T2]" output
  29. @end example
  30. The result will be that in output the top half of the video is mirrored
  31. onto the bottom half.
  32. Video filters are loaded using the @var{-vf} option passed to
  33. ffmpeg or to ffplay. Filters in the same linear chain are separated by
  34. commas. In our example, @var{split, fifo, overlay} are in one linear
  35. chain, and @var{fifo, crop, vflip} are in another. The points where
  36. the linear chains join are labeled by names enclosed in square
  37. brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic
  38. labels @var{[in]} and @var{[out]} are the points where video is input
  39. and output.
  40. Some filters take in input a list of parameters: they are specified
  41. after the filter name and an equal sign, and are separated each other
  42. by a semicolon.
  43. There exist so-called @var{source filters} that do not have a video
  44. input, and we expect in the future some @var{sink filters} that will
  45. not have video output.
  46. @chapter graph2dot
  47. The @file{graph2dot} program included in the FFmpeg @file{tools}
  48. directory can be used to parse a filter graph description and issue a
  49. corresponding textual representation in the dot language.
  50. Invoke the command:
  51. @example
  52. graph2dot -h
  53. @end example
  54. to see how to use @file{graph2dot}.
  55. You can then pass the dot description to the @file{dot} program (from
  56. the graphviz suite of programs) and obtain a graphical representation
  57. of the filter graph.
  58. For example the sequence of commands:
  59. @example
  60. echo @var{GRAPH_DESCRIPTION} | \
  61. tools/graph2dot -o graph.tmp && \
  62. dot -Tpng graph.tmp -o graph.png && \
  63. display graph.png
  64. @end example
  65. can be used to create and display an image representing the graph
  66. described by the @var{GRAPH_DESCRIPTION} string.
  67. @include filters.texi
  68. @bye