[FFMPEG]AVFILTERS:多个同时使用,同时叠加文字和图片

##1.环境

  • ubuntu 16.04.1 64位
  • 编解码使用nvidia的硬件加速接口
  • 调用方式ffmpeg api

##2.多filters研究
###2.1.filter_spec描述
char video_filter_spec = "drawtext=fontfile=FreeSerif.ttf:
fontsize=36:
[email protected]:
x='if(gte(t,5), (main_w-mod(t
30,main_w+text_w)), NAN)’:
y=500:
text=‘Hello, this is drawtext function,any more questsion can concat su.gao([email protected])!’ [text];
movie=/root/mscore/extern/source/logo/test.png [wm];
[text] [wm] overlay=0:0 [out]";

###2.2.filter_spec描述解读
1.从左到右滚动播出Hello, this is drawtext function,any more questsion can concat su.gao([email protected])!的内容,字体颜色为黄色,字体透明度100%,字体大小为36,字体FreeSerif。且将视频输出管道打上标签text;

drawtext=fontfile=FreeSerif.ttf:\
fontsize=36: \
[email protected]: \
x='if(gte(t,5), (main_w-mod(t*30,main_w+text_w)), NAN)':\
y=500:\
text='Hello, this is drawtext function,any more questsion can concat su.gao([email protected])!' [text];

2.将图片test.png叠加到标签为text的视频上,位置为左上角;

movie=/root/mscore/extern/source/logo/test.png [wm]; \
[text] [wm] overlay=0:0 [out]";

###2.3.filters使用情况
nb_filters:5
----------------------
filters:in(buffer)
filters outputs:default(0)
----------------------
----------------------
filters:out(buffersink)
filters inputs:default(0)
----------------------
----------------------
filtersarsed_drawtext_0(drawtext)
filters inputs:default(0)
filters outputs:default(0)
----------------------
----------------------
filtersarsed_movie_1(movie)
----------------------
----------------------
filtersarsed_overlay_2(overlay)
filters inputs:main(0)
filters outputs:default(0)
----------------------

##3.效果图
[FFMPEG]AVFILTERS:多个同时使用,同时叠加文字和图片_第1张图片

##4.参考

  • ffmpeg wiki
  • Create a mosaic out of several input videos

你可能感兴趣的:(FFMPEG-随心分享)