libavfilter.texi 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 in.avi -s 240x320 -vf "[in] split [T1], fifo, [T2] overlay= 0:240 [out]; [T1] fifo, crop=0:0:-1:240, vflip [T2]
  29. @end example
  30. where input_video.avi has a vertical resolution of 480 pixels. The
  31. result will be that in output the top half of the video is mirrored
  32. onto the bottom half.
  33. Video filters are loaded using the @var{-vf} option passed to
  34. ffmpeg or to ffplay. Filters in the same linear chain are separated by
  35. commas. In our example, @var{split, fifo, overlay} are in one linear
  36. chain, and @var{fifo, crop, vflip} are in another. The points where
  37. the linear chains join are labeled by names enclosed in square
  38. brackets. In our example, that is @var{[T1]} and @var{[T2]}. The magic
  39. labels @var{[in]} and @var{[out]} are the points where video is input
  40. and output.
  41. Some filters take in input a list of parameters: they are specified
  42. after the filter name and an equal sign, and are separated each other
  43. by a semicolon.
  44. There exist so-called @var{source filters} that do not have a video
  45. input, and we expect in the future some @var{sink filters} that will
  46. not have video output.
  47. @chapter graph2dot
  48. The @file{graph2dot} program included in the FFmpeg @file{tools}
  49. directory can be used to parse a filter graph description and issue a
  50. corresponding textual representation in the dot language.
  51. Invoke the command:
  52. @example
  53. graph2dot -h
  54. @end example
  55. to see how to use @file{graph2dot}.
  56. You can then pass the dot description to the @file{dot} program (from
  57. the graphviz suite of programs) and obtain a graphical representation
  58. of the filter graph.
  59. For example the sequence of commands:
  60. @example
  61. echo @var{GRAPH_DESCRIPTION} | \
  62. tools/graph2dot -o graph.tmp && \
  63. dot -Tpng graph.tmp -o graph.png && \
  64. display graph.png
  65. @end example
  66. can be used to create and display an image representing the graph
  67. described by the @var{GRAPH_DESCRIPTION} string.
  68. @include filters.texi
  69. @bye