ffmpeg叠加水印

图片是雷神的。

 叠加的图片只能png、jpg ?

1 解码的流程,见https://blog.csdn.net/chenquangobeijing/article/details/128808165

//1 AVFilter初始化, 需要输入src, 输出sink
avfilter_graph_create_filter(&m_BufferSrcCtx, buffersrc, "in", args, nullptr, m_FilterGraph);

avfilter_graph_create_filter(&m_BufferSinkCtx, buffersink, "out", nullptr, buffersinkparams, m_FilterGraph);

avfilter_graph_parse_ptr(m_FilterGraph, FiltersDescr,&inputs, &outputs, nullptr);

avfilter_graph_config(m_FilterGraph, nullptr);


//2 解码成YUV后,取叠加后的数据
av_buffersrc_add_frame(m_BufferSrcCtx, m_pFrame);

AVFilterBufferRef *picref;
av_buffersink_get_buffer_ref(m_BufferSinkCtx, &picref, 0);//叠加后的数据在picref
ffmpeg命令行:
//叠加水印
//overlay=5:15,图片距左边5个像素点,距上边15个像素点
ffmpeg -i test.flv -vf "movie=my_logo.png[wm];[in][wm]overlay=5:15[out]" out.flv


//去除水印, 
ffmpeg -i test.flv -vf "delogo=x=5:y=15:w=180:h=60:show=0" out.flv

你可能感兴趣的:(ffmpeg,音视频)