zoukankan      html  css  js  c++  java
  • 使用VHook为视频添加水印

    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 a
    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 the
    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 to
    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 an
    MPEG video, and places "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/
    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
  • 相关阅读:
    RecyclerView 数据刷新的几种方式 局部刷新 notify MD
    【图片】批量获取几万张图片
    RV BaseRecyclerViewAdapterHelper 总结 MD
    RecyclerView.ItemDecoration 间隔线
    Kotlin【简介】Android开发 配置 扩展
    Kotlin 特性 语法糖 优势 扩展 高阶 MD
    一个十分简洁实用的MD风格的UI主框架
    折叠伸缩工具栏 CollapsingToolbarLayout
    FloatingActionButton FAB 悬浮按钮
    Glide Picasso Fresco UIL 图片框架 缓存 MD
  • 原文地址:https://www.cnblogs.com/top5/p/1636347.html
Copyright © 2011-2022 走看看