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.

114 lines
3.8KB

  1. \input texinfo @c -*- texinfo -*-
  2. @settitle Video Hook Documentation
  3. @titlepage
  4. @sp 7
  5. @center @titlefont{Video Hook Documentation}
  6. @sp 3
  7. @end titlepage
  8. @chapter Introduction
  9. The video hook functionality is designed (mostly) for live video. It allows
  10. the video to be modified or examined between the decoder and the encoder.
  11. Any number of hook modules can be placed inline, and they are run in the
  12. order that they were specified on the ffmpeg command line.
  13. Three modules are provided and are described below. They are all intended to
  14. be used as a base for your own modules.
  15. Modules are loaded using the -vhook option to ffmpeg. The value of this parameter
  16. is a space separated list of arguments. The first is the module name, and the rest
  17. are passed as arguments to the Configure function of the module.
  18. @section null.c
  19. This does nothing. Actually it converts the input image to RGB24 and then converts
  20. it back again. This is meant as a sample that you can use to test your setup.
  21. @section fish.c
  22. This implements a 'fish detector'. Essentially it converts the image into HSV
  23. space and tests whether more than a certain percentage of the pixels fall into
  24. a specific HSV cuboid. If so, then the image is saved into a file for processing
  25. by other bits of code.
  26. Why use HSV? It turns out that HSV cuboids represent a more compact range of
  27. colors than would an RGB cuboid.
  28. @section imlib2.c
  29. This module implements a text overlay for a video image. Currently it
  30. supports a fixed overlay or reading the text from a file. The string
  31. is passed through strftime so that it is easy to imprint the date and
  32. time onto the image.
  33. You may also overlay an image (even semi-transparent) like TV stations do.
  34. You may move either the text or the image around your video to create
  35. scrolling credits, for example.
  36. Text fonts are being looked for in a FONTPATH environment variable.
  37. Options:
  38. @multitable @columnfractions .2 .8
  39. @item @option{-c <color>} @tab The color of the text
  40. @item @option{-F <fontname>} @tab The font face and size
  41. @item @option{-t <text>} @tab The text
  42. @item @option{-f <filename>} @tab The filename to read text from
  43. @item @option{-x <expresion>} @tab X coordinate of text or image
  44. @item @option{-y <expresion>} @tab Y coordinate of text or image
  45. @item @option{-i <filename>} @tab The filename to read a image from
  46. @end multitable
  47. Expresions are functions of these variables:
  48. @multitable @columnfractions .2 .8
  49. @item @var{N} @tab frame number (starting at zero)
  50. @item @var{H} @tab frame height
  51. @item @var{W} @tab frame width
  52. @item @var{h} @tab image height
  53. @item @var{w} @tab image width
  54. @item @var{X} @tab previous x coordinate of text or image
  55. @item @var{Y} @tab previous y coordinate of text or image
  56. @end multitable
  57. You may also use the constants @var{PI}, @var{E}, and the math functions available at the
  58. FFmpeg formula evaluator at (@url{ffmpeg-doc.html#SEC13}), except @var{bits2qp(bits)}
  59. and @var{qp2bits(qp)}.
  60. Usage examples:
  61. @example
  62. # Remember to set the path to your fonts
  63. FONTPATH="/cygdrive/c/WINDOWS/Fonts/"
  64. FONTPATH="$FONTPATH:/usr/share/imlib2/data/fonts/"
  65. FONTPATH="$FONTPATH:/usr/X11R6/lib/X11/fonts/TTF/"
  66. export FONTPATH
  67. # Bulb dancing in a Lissajous pattern
  68. ffmpeg -i input.avi -vhook \
  69. 'vhook/imlib2.dll -x W*(0.5+0.25*sin(N/47*PI))-w/2 -y H*(0.5+0.50*cos(N/97*PI))-h/2 -i /usr/share/imlib2/data/images/bulb.png' \
  70. -acodec copy -sameq output.avi
  71. # Text scrolling
  72. ffmpeg -i input.avi -vhook \
  73. 'vhook/imlib2.dll -c red -F Vera.ttf/20 -x 150+0.5*N -y 70+0.25*N -t Hello' \
  74. -acodec copy -sameq output.avi
  75. @end example
  76. @section ppm.c
  77. It's basically a launch point for a PPM pipe, so you can use any
  78. executable (or script) which consumes a PPM on stdin and produces a PPM
  79. on stdout (and flushes each frame).
  80. Usage example:
  81. @example
  82. ffmpeg -i input -vhook "/path/to/ppm.so some-ppm-filter args" output
  83. @end example
  84. @bye