Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to place several overlays on top of each other and fade out the topmost after some frames. Therefore I'm using 2 .png files which should be placed on the final video in the following order:

fademe.png <-- Topmost overlay, should be faded after some frames

overlay.png <-- second overlay, always visible <-- a movie as the bottom layer

I'm using this code to create a PNG encoded .mov from the overlays:

ffmpeg -y -loop 1 -i fademe.png -loop 1 -i overlay.png -filter_complex "[0:0]fade=out:25:25[fad];[1:0][fad] overlay" -vframes 55 -vcodec png

Then I'm using ffmbc to place on top of another video.

(I'm using ffmbc because the final output is going to be ProRes4444)

ffmbc -y -threads 0 -i -vf " [watermark]; [in][watermark] overlay [out]"  -vcodec libx264 faded.mp4

The output video looks nice until fading starts and fademe.png [fad] seems to get faded to white and doing some strange things to the colours below until it disappears.

When I'm changing the order in the last overlay from [1:0][fad] overlay to [fad][1:0] overlay so it looks like this:

ffmpeg -y -loop 1 -i fademe.png -loop 1 -i overlay.png -filter_complex "[0:0]fade=out:25:25[fad];[fad][1:0] overlay" -vframes 55 -vcodec png

the fading looks right, but overlay.png [1:0] shouldn't be the topmost layer.

My guess is that something wrong happens to the alpha-channel on my first try.

Any suggestions how to solve this problem?

share|improve this question

It should not be necessary to use two commands and create an intermediate file with an alpha channel. A single command with 3 inputs, 2 overlay filters, and a fade filter with alpha=1 should do it:

ffmpeg -y -i -loop 1 -i overlay.png -loop 1 -i fademe.png \
-filter_complex '[0:v][1:v] overlay [V1]; \
[2:v] fade=out:25:25:alpha=1 [V2]; [V1][V2] overlay' \
share|improve this answer
Sadly, ffmbc can't handle -filter_complex. Is there any way doing the same thing with the -vf option? – evilheinz Mar 22 '13 at 9:10
@evilheinz Unfortunately, ffmbc is quite behind in development. Is there any reason you need it and can't use FFmpeg? Ideally, ffmbc's additional features would be ported back to FFmpeg. – slhck Mar 22 '13 at 9:40
@evilheinz the most essential difference between this command and yours is that this one is fading out to alpha (this isn't the default); try using [0:0]fade=out:25:25:alpha=1[fad] in your first command. – evilsoup Mar 22 '13 at 11:11
@slhck I was planning to use ffmbc to get an ProRes4444 as output. Last time I checked the ProRes4444 encoding on ffmpeg, it didn't set the right fourcc so it was recognized as ProRes422 (HQ) in Quicktime Player. When transcoding with ffmbc the file gets correctly detected as ProRes4444. – evilheinz Mar 22 '13 at 12:12
@evilsoup the fading still looks kind of funked up when using alpha=1... – evilheinz Mar 22 '13 at 12:16
up vote 1 down vote accepted

I think i found a solution:

First I created a intermediate movie of the fading logo

ffmpeg -y -loop 1  -i fademe.png -filter_complex "fade=out:25:25" -vframes 55 -vcodec png

then I used this command with ffmbc

ffmbc -i -vf "movie=overlay.png [over]; [fade]; [in][over] overlay [inter]; [inter][fade] overlay [out]" -vcodec libx264 out.mp4


The logo sitting on top of the composition is fading away nice and smooth!

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .