Question

I'm trying to render a watermark into a video. The moment the image file (.png) for the watermark contains transparency the image isn't rendered into the video anymore. If I convert that image to .jpg and back to .png it works well. If I create a new png that don't have transparency it works too. But when I add e.g. layer opacity to that image it isn't rendered anymore.

I use avconv 0.8.6-4:0.8.6-0ubuntu0.12.04.1 with the following command

avconv -y -i video.mp4 -f 'movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]' -c:v libx264 -t 255 -strict experimental out.mp4

If I use .gif for the watermark I get the image, but it's all opaque.

Any clue?

Was it helpful?

Solution

The answer to my question is simple, though it took me a day to find it.

The "normal" ffmpeg that comes with the repository of my Ubuntu distro complained about the "c: v libx264" parameter. avconv knows that parameter but is buggy; it just doesn't render transparent images.

The solution was as simple as installing the very latest ffmpeg version (i choosed the static version). Now it works like a charm. :)

OTHER TIPS

This is how I'v managed to add a watermark on a mp4 file (top left) with avconv version 0.8.6-6:0.8.6-1ubuntu2.

avconv -y -i source.mp4 -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" -c:v libx264 target.mp4

Hope it helps someone.

If you happen to be using ffmpeg-1.2 rather than avconv then the command is a fairly simple:

ffmpeg -i source.mp4 -i logo.png -filter_complex 'overlay' -strict -2 outputmovie.mp4

This worked fine for me, with the transparency baked into the logo.png file. Just make sure there is an alpha there. This also assumes the logo.png file is the same size as the reference material.

I Used the transparent png image and it worked for me. Now I can see the scene behind the watermark in the video as the png watermark image is transparent. So just edit the image via photoshop and add 50% opacity(or whatever value you want) in the image.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top