[Libav-user] Overlay filter (add Watermark to video)
Alberto Martín Fernandez
amartin at grupoblidoo.com
Wed Oct 1 17:48:21 CEST 2014
Hi;
I am using ffmpeg 1.0.9 & SDL 1.2 and i am trying to add a watermark.
I started to implement my media player basing on the ffplay example, adding
funtionalities, buttons...
I have to implement an overlay filter, so i do:
FILTER 1:(Video base) INPUT
avfilter_graph_create_filter(&filt_src, avfilter_get_by_name("buffer"),
"in", buffersrc_args,NULL,graph);
FILTER 2: (overlay filter, watermark(png)) INPUT
avfilter_graph_create_filter(&bufferovrlay_ctx,avfilter_get_by_name("overlay"),
"overlay", argsStrOvrlay, NULL, graph);
FILTER 3: (buffersink filter) OUTPUT
avfilter_graph_create_filter(&filt_out,
avfilter_get_by_name("ffbuffersink"),
"out", NULL, buffersink_params, graph);
Then i call :
avfilter_graph_parse(graph,
"buffer=video_size=640x360:pix_fmt=0:time_base=1001/3000:pixel_aspect=0/1
[in_1]; buffer=video_size=512x128:pix_fmt=2:time_base=1/1:pixel_aspect=0
[in_2]; [in_1] [in_2] overlay=0:0 [out]; [out] buffersink", inputs,
&outputs, NULL);
Then i call avfilter_graph_config(graph, NULL);
and it returnrs -22 error (AVERROR_INVALIDDATA)
I have some questions:
Which are the correct parameters to set in a overlay filter (argsStrOvrlay)?
I set sprintf_s(argsStrOvrlay, sizeof(argsStrOvrlay),
"video_size=%dx%d:pix_fmt=%d:time_base=1/1:pixel_aspect=0",
pCodecCtxImage->width, pCodecCtxImage->height, pCodecCtxImage->pix_fmt);
I am not sure if i need to link the filters using avfilter_link.
Has anyone an example of adding a watermark image to a video using overlay
filter?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20141001/533946e1/attachment.html>
More information about the Libav-user
mailing list