[FFmpeg-devel] libavfilter: extending overlay filter

Mark Himsley mark
Sun Mar 13 15:18:42 CET 2011

Dear Developers,

I have extended the overlay filter so that it can overlay BGRA, RGBA, 
ABGR and ARGB streams over BGR24, RGB24, ARGB, RGBA, ABGR and BGRA 
backgrounds (extended from yuva420p over a yuv420p background), 
including adding the ability to output non-pre-multiplied video and 
combined alpha when the main input background has alpha.

This is working really well for keying BGRA over BGRA, and outputting 
combined fill+key for use in professional editing software.

With the extension I have added, the overlay filter must have either YUV 
type inputs for BOTH the main and overlay OR have BGR type inputs for 
BOTH the main and overlay inputs.

That means that, with the extension I have added, I have broken the more 
usual YUV for the main and BGR for the overlay.

This has happened because I have allowed the filter to accept the BGR 
type inputs (adding to the PixelFormat enums), so ffmpeg doesn't 
automatically insert a BGR to YUV filter any more.

It is not an insurmountable problem for users to change their filter from:

-vf "movie='text.tif' [movie]; [in][movie] overlay=0:0 [out]"


-vf "movie='text.tif', format=yuva420p [movie]; [in][movie] overlay=0:0 

But, is it possible for the filter to programmatically insert the format 
change filter so that my extension does not break users current filter 

I would like to submit my extension for inclusion into libavfilter but I 
don't feel that I can submit it while it breaks users current filter 



More information about the ffmpeg-devel mailing list