[Libav-user] Adding an overlay for video using ffmpeg

stanbav at openmailbox.org stanbav at openmailbox.org
Fri Mar 18 10:46:55 CET 2016

Hi, guys!

I am using ffmpeg to add an overlay (image) for a video.

Now I am passing a string const char *filters like 
"movie=image.png[wm];[in][wm]overlay=5:5[out]" to
avfilter_graph_parse_ptr (AVFilterGraph *graph, const char *filters, 
AVFilterInOut **inputs, AVFilterInOut **outputs, void *log_ctx)
function returns 1 and everything looks fine until second call of ret = 
ffmpeg.avcodec_encode_video2(pCodecCtx, &pkt, pFrame, &got_output); 
On the first call it returns 0, but on the second call 
avcodec_encode_video2 function returns -1.

Has anyone faced same issue ?
Or maybe someone can share a working sample ?

More information about the Libav-user mailing list