使用VHook为视频添加水印
2009-12-30 20:51
453 查看
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
相关文章推荐
- Android-使用ffmpeg添加视频水印过慢问题
- Android使用FFmpeg给图片视频添加水印
- ffmpeg 代码实现视频添加水印功能
- ffmpeg 视频添加水印
- Android录制视频添加水印
- Java使用OpenCV实现人脸识别/人眼检测/图片截取/合成/添加水印
- ffmpeg 视频添加水印 logo
- 【视频】配置信息管理 的 使用方法(二):建表、添加元数据
- javaCV开发详解之4:转流器实现(也可作为本地收流器、推流器,新增添加图片及文字水印,视频图像帧保存),实现rtsp/rtmp/本地文件转发到rtmp流媒体服务器(基于javaCV-FFMPEG)
- C# 使用IHttpHandler给图片添加水印(图片/文字)
- iOS 视频剪切、旋转,视频添加音频、添加水印,视频导出
- php使用ffmpeg向视频中添加文字字幕的实现方法
- asp .net 为图片添加文字水印(内包含有加图片水印的方法,但尚未完善暂不能使用)
- 使用ASPJPEG添加水印的方法
- ffmpeg 代码实现视频添加水印功能
- 最好 FFmpeg 给视频 添加水印 添加标注
- php实现ckeditor编辑器添加水印及使用误区
- 最新版本的ppsip v3 SDK(采用全新的架构,并添加了视频支持,音视频引擎使用GIPS(基于WebRTC))发布了(联系dotphoenix@qq.com)。
- C#使用 DirectX SDK 9做视频播放器 并在视频画线添加文字 VMR9
- opencv给视频添加文字_ cvPutText使用说明