[FFmpeg-soc] [PATCH] updated! vf_overlay alpha patch and watermarking using PNG with alpha

Vitor Sessak vitor1001 at gmail.com
Tue Dec 1 00:50:50 CET 2009


Artur Bodera wrote:
> For those that have given up on ffmpeg and +libavfilter -vhook debacle.
> 
> Here's a "just add water" solution to all your trouble: transparent PNG's
> and watermarks in recent ffmpeg compilations.
> 
> I'm attaching a working patch that will enable alpha-transparency in overlay
> filter. This, on the other hand, will let you use overlay filter to
> superimpose a video clip or transparent png watermark on another video. This
> has been tested with recent revisions of svn://
> svn.ffmpeg.org/soc/libavfilter rev. 5387 and ffmpeg rev. 19868 (16 Sep
> 2009). Compiled and running under both x86 and x86_64 on linux.
> 
> 
> Example 1 - insert transparent PNG watermark in bottom left corner of the
> video:
> -vfilters "movie=0:png:logo.png [wm];[in][wm] overlay=10:mainH-overlayH-10:1
> [out]"
> 
> Notice the last parameter to overlay ":1" - this enables alpha blending.
> 
> 
> Example 2 - insert 2 different transparent PNG watermarks (second watermark
> on bottom right corner):
> -vfilters "movie=0:png:logo.png [wm];movie=0:png:logo2.png [awm];[in][wm]
> overlay=10:mainH-overlayH-10:1 [int];[int][awm]
> overlay=mainW-overlayW-10:mainH-overlayH-10:1 [out]"
> 
> You could chain and add more overlays this way but the efficiency of such
> approach is yet to be tested.
> 
> 
> This should save you a lot of time and you can continue to use your favorite
> transcoder for web video publishing!

While I normally oppose making non-committed code more complex, I think 
this feature is so often requested that it is worth the extra work in 
the future. Stefano, Michael, any strong opinion about this?

-Vitor



More information about the FFmpeg-soc mailing list