1.环境:ubuntu16.04 64位
2.编解码使用nvidia的硬件加速接口
3.使用方式ffmpeg api调用;
4.video_filter_spec定义如下:
char *video_filter_spec = "drawtext=fontfile=FreeSerif.ttf:\
fontsize=36: \
fontcolor=yellow@1.0: \
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(sugao_cn@163.com)!' [text]; \
movie=/root/mscore/extern/source/logo/test.png [wm]; \
[text] [wm] overlay=0:0 [out]";
使用的filters如下
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1362] nb_filters:5
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1369] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1370] filters:in(buffer)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1372] filters outputs:default(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1373] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1369] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1370] filtersut(buffersink)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1371] filters inputs:default(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1373] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1369] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1370] filtersarsed_drawtext_0(drawtext)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1371] filters inputs:default(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1372] filters outputs:default(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1373] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1369] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1370] filtersarsed_movie_1(movie)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1373] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1369] ----------------------
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1370] filtersarsed_overlay_2(overlay)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1371] filters inputs:main(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1372] filters outputs:default(0)
2017-02-08 19:11:26[msffmpeg_opt_set] [driver/ffmpeg_opt_set.c msffmpeg_api_initvideofilters 1373] ----------------------
效果图:
|