Use vhook to add a watermark to a video

Source: Internet
Author: User
Tags drawtext time and date
Imlib2.c
# Remember to set the path to your fonts
Fontpath = "/cygdrive/C/Windows/fonts /"
Fontpath = "$ fontpath:/usr/share/imlib2/data/fonts /"
Fontpath = "$ fontpath:/usr/x11r6/lib/X11/fonts/TTF /"
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
# Date and time stamp, security-camera style:
FFmpeg-r 29.97-s 320x256-F video4linux-I/dev/video0 \
-Vhook 'vhook/imlib2.so-x 0-Y 0-I black-260x20.png '\
-Vhook 'vhook/imlib2.so-C White-F verabd. TTF/12-x 0-Y 0-T % A-% d-% t '\
Output. Avi
 
In this example the video is captured from the first video capture card as
320x256 Avi, and a black 260 by 20 pixel PNG image is placed in the upper
Left corner, with the day, date and time overlaid on it in Vera bold 12
Point font. A simple black PNG file 260 pixels wide and 20 pixels tall
Was created in the gimp for this purpose.
 
# Scrolling credits from a text file
FFmpeg-I input. Avi-vhook \
'Vhook/imlib2.so-C White-F verabd. TTF/16-x 100-y-1.0 * n-F credits.txt '\
-Sameq output. Avi
In this example, the text is stored in a file, and is positioned 100
Pixels from the left hand edge of the video. The text is scrolled from
Bottom up. Making the y factor positive will scroll from the top down.
Increasing the magnitude of the Y factor makes the text scroll faster,
Decreasing it makes it scroll slower. Hint: blank lines containing only
A newline are treated as end-of-file. To create blank lines, use lines
That consist of space characters only.
 
# Scrolling credits with custom color from a text file
FFmpeg-I input. Avi-vhook \
'Vhook/imlib2.so-C rgb.txt-C customcolor1-F verabd. TTF/16-x 100-y-1.0 * n-F credits.txt '\
-Sameq output. Avi
 
This example does the same as the one above, but specifies an rgb.txt File
To be used, which has a custom-made color in it.
# Variable colors
FFmpeg-I input. Avi-vhook \
'Vhook/imlib2.so-T hello-r ABS (255 * sin (N/47 * PI)-g abs (255 * sin (N/47 * PI )) -B ABS (255 * sin (N/47 * PI ))'\
-Sameq output. Avi
 
In this example, the color for the text goes up and down from black
White.
 
# Text fade-out
FFmpeg-I input. Avi-vhook \
'Vhook/imlib2.so-T hello-a max (0,255-exp (N/47 ))'\
-Sameq output. Avi
 
In this example, the text fades out in about 10 seconds for a 25 FPS Input
Video file.
 
# Scrolling credits from a graphics file
FFmpeg-sameq-I input. Avi \
-Vhook 'vhook/imlib2.so-x 0-y-1.0 * n-I credits.png 'output. Avi
In this example, a transparent PNG file the same width as the video
(E.g. 320 pixels), but very long, (e.g. 3000 pixels), was created, and
Text, graphics, brushstrokes, etc, were added to the image. The image
Is then scrolled up, from the bottom of the frame.

Drawtext. c

 
# Remember to set the path to your fonts
Fontpath = "/cygdrive/C/Windows/fonts /"
Fontpath = "$ fontpath:/usr/share/imlib2/data/fonts /"
Fontpath = "$ fontpath:/usr/x11r6/lib/X11/fonts/TTF /"
Export fontpath
 
# Time and date display
FFmpeg-F video4linux2-I/dev/video0 \
-Vhook 'vhook/drawtext. So-F verabd. TTF-T % A-% d-% t' movie. mpg
This example grabs video from the first capture card and outputs it to
MPEG video, and places "weekday-dd/mm/yy-hh: mm: SS" at the top left of
Frame, updated every second, using the Vera bold TrueType font, which
Shocould exist in:/usr/x11r6/lib/X11/fonts/TTF/

Watermark. c

 
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.