[Ffmpeg-devel] [RFC]: vhook Documentation

C.Ren Boca crboca32
Wed Jan 17 06:45:45 CET 2007

--- hooks.texi 2007-01-17 00:30:30.000000000 -0500
+++ hooks.texi.new 2007-01-17 00:38:32.000000000 -0500
@@ -39,63 +39,57 @@
 Why use HSV? It turns out that HSV cuboids represent a more compact range of
 colors than would an RGB cuboid.
- at section imlib2.c
+This is a starting point for motion detection processing.
+ at section drawtext.c
 This module implements a text overlay for a video image. Currently it
 supports a fixed overlay or reading the text from a file. The string
-is passed through strftime so that it is easy to imprint the date and
+is passed through strftime() so that it is easy to imprint the date and
 time onto the image.
-You may also overlay an image (even semi-transparent) like TV stations do.
-You may move either the text or the image around your video to create
-scrolling credits, for example.
+- True Type, Type1 and others via FreeType2 library
+- Font kerning (better output)
+- Line Wrap (if the text doesn't fit, the next char goes to the next line)
+- Background box (currently in development)
+- Outline 
 Text fonts are being looked for in a FONTPATH environment variable.
 @multitable @columnfractions .2 .8
- at item @option{-c <color>}     @tab The color of the text
- at item @option{-F <fontname>}  @tab The font face and size
- at item @option{-t <text>}      @tab The text
- at item @option{-f <filename>}  @tab The filename to read text from
- at item @option{-x <expresion>} @tab X coordinate of text or image
- at item @option{-y <expresion>} @tab Y coordinate of text or image
- at item @option{-i <filename>}  @tab The filename to read a image from
- at end multitable
-Expresions are functions of these variables:
- at multitable @columnfractions .2 .8
- at item @var{N} @tab frame number (starting at zero)
- at item @var{H} @tab frame height
- at item @var{W} @tab frame width
- at item @var{h} @tab image height
- at item @var{w} @tab image width
- at item @var{X} @tab previous x coordinate of text or image
- at item @var{Y} @tab previous y coordinate of text or image
+ at item @option{-c <color>}          @tab Foreground color of the text ('internet' way) <#RRGGBB> [default #ffffff]
+ at item @option{-C <color>}          @tab Background color of the text ('internet' way) <#RRGGBB> [default #000000]
+ at item @option{-f <font-filename>}  @tab The font file to use
+ at item @option{-o }                 @tab Outline glyphs using the background color
+ at item @option{-t <text>}           @tab The text to display
+ at item @option{-T <filename>}       @tab The filename to read text from
+ at item @option{-x <pos>}            @tab X coordinate of the start of text 
+ at item @option{-y <pos>}            @tab Y coordinate of the start of text 
 @end multitable
-You may also use the constants @var{PI}, @var{E}, and the math functions available at the
-FFmpeg formula evaluator at (@url{ffmpeg-doc.html#SEC13}), except @var{bits2qp(bits)}
-and @var{qp2bits(qp)}.
-Usage examples:
+Usage Example:
    # Remember to set the path to your fonts
-   FONTPATH="/cygdrive/c/WINDOWS/Fonts/"
-   FONTPATH="$FONTPATH:/usr/share/imlib2/data/fonts/"
    export FONTPATH
-   # Bulb dancing in a Lissajous pattern
-   ffmpeg -i input.avi -vhook \
-     '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' \
-     -acodec copy -sameq output.avi
-   # Text scrolling
-   ffmpeg -i input.avi -vhook \
-     'vhook/imlib2.dll -c red -F Vera.ttf/20 -x 150+0.5*N -y 70+0.25*N -t Hello' \
-     -acodec copy -sameq output.avi
+   # When run from your build location:
+   ./ffmpeg  -vd /dev/video0  -vhook 'vhook/drawtext.so -f VeraBd.ttf -t %A-%D-%T' movie.mpg 
+   Will grab video from the first capture card and output it to a MPEG video,
+   And place  "Weekday-dd/mm/yy-hh:mm:ss" at the top left of the frame, updated every second,
+   using the Vera Bold TrueType Font, which should exist in: /usr/X11R6/lib/X11/fonts/TTF/   
+   If ffmpeg is installed, it should be in your $PATH, make sure to specify the full path 
+   of the vhook ".so" file that you are using. 
+   If the FONTPATH environment variable is not available, or is not checked by your target 
+   (i.e. Cygwin), then specify the full fontpath as in: -f /usr/X11R6/lib/X11/fonts/TTF/VeraBd.ttf 
+   Check the manpage for strftime() for all the various ways you can format the date and time.
 @end example
 @section ppm.c
@@ -107,7 +101,44 @@
 Usage example:
-ffmpeg -i input -vhook "/path/to/ppm.so some-ppm-filter args" output
+   ffmpeg -i input -vhook "/path/to/ppm.so some-ppm-filter args" output
 @end example
+ at section watermark.c
+Command Line options:
+-m [0|1]  Mode. Zero is the default Mode, see below.
+-t 000000 - ffffff  Threshold. Six digit hex. 
+-f <filename> - Watermark image filename. You must specify this!
+MODE 0:
+ The watermark picture works like this (assuming color intensities 0..0xff):
+ Per color do this:
+ If mask color is 0x80, no change to the original frame.
+ If mask color is < 0x80 the abs difference is subtracted from the frame. If
+ result < 0, result = 0
+ If mask color is > 0x80 the abs difference is added to the frame. If result
+ > 0xff, result = 0xff
+ You can override the 0x80 level with the -t flag. E.g. if threshold is
+ 000000 the color value of watermark is added to the destination.
+ This way a mask that is visible both in light pictures and in dark can be
+ made (fex by using a picture generated by Gimp and the bump map tool).
+ An example watermark file is at
+ http://engene.se/ffmpeg_watermark.gif
+MODE 1:
+ Per color do this:
+ If mask color > threshold color then the watermark pixel is used.
+Example usage:
+ at example
+   ffmpeg -i infile -vhook '/path/watermark.so -f wm.gif' -an out.mov
+   ffmpeg -i infile -vhook '/path/watermark.so -f wm.gif -m 1 -t 222222' -an out.mov
+ at end example

Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food & Drink Q&A.

More information about the ffmpeg-devel mailing list