[MPlayer-dev-eng] [PATCH] New video filter: deblendlogo
Martin Atkins
mart at degeneration.co.uk
Sat Feb 19 20:07:07 CET 2005
Hi folks,
The attached C source file implements a new video filter which attempts
to remove alpha-blended logos by reversing the alpha blend to recover
the original colour. To use it, the user must create a template in the
form of a PNG image with an alpha channel which gives the filter the
alpha value and colour used at each point in the logo. Since it uses
libpng to decode the template, the filter is only included if libpng is
present.
This template is easy to create if the logo is all white: just wait
until a frame where the screen is completely black and use the luminance
of the logo on that frame as the alpha channel in an all-white PNG
image. If the logo also features black and other colours it's more
tricky as you need to extract each colour separately and merge them
together into a single template. A tool could be made to automate much
of this, but I've not written it yet. I just created the templates
manually in a graphics program from frames dumped to disk.
I tested this with the logos from TheWB and ABC, but of course I can't
supply samples because of trademark/copyright issues.
The filter currently only operates on RGB-type images, which means it's
not really useable from mplayer since the accelerated vo devices usually
want YUV images. It's more useful for preprocessing near-raw video with
mencoder before applying a more "aggressive" codec. Applying the filter
to a video which has already been heavily compressed can cause some
weird effects due to the resolution difference under the watermark,
especially in the presence of hardframedrop.
I've not tested the ARGB and ABGR formats because I couldn't find any
output devices/codecs that actually support them. I'm a bit unsure about
the image format stuff because BGRA and RGBA both seem to be the same,
for some reason.
See also the comments at the start of the source file for more notes and
caveats.
This is the first time I've delved into mplayer's innards, so let me
know if I've done anything wrong with regard to code style as well as API.
All the best,
Martin Atkins
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vf_deblendlogo-patch.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050219/c9e77932/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vf_deblendlogo.c
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20050219/c9e77932/attachment.txt>
More information about the MPlayer-dev-eng
mailing list