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

Artur Bodera abodera at gmail.com
Mon Nov 30 23:44:42 CET 2009


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!

With best regards.

-- 
     __
    /.)\   +48 695 600 936
    \(./   abodera at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vf_overlay-alpha.patch
Type: application/octet-stream
Size: 4616 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20091130/89a02f94/attachment.obj>


More information about the FFmpeg-soc mailing list