6

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

movie.mov <-- 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 overlay.mov

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

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

ffmbc -y -threads 0 -i movie.mov -vf "movie=overlay.mov [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 overlay.mov

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?

2 Answers 2

7

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 movie.mov -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' \
faded.mp4
5
  • Sadly, ffmbc can't handle -filter_complex. Is there any way doing the same thing with the -vf option?
    – evilheinz
    Mar 22, 2013 at 9:10
  • 1
    @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, 2013 at 9:40
  • 1
    @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, 2013 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, 2013 at 12:12
  • @evilsoup the fading still looks kind of funked up when using alpha=1...
    – evilheinz
    Mar 22, 2013 at 12:16
1

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 fademe.mov

then I used this command with ffmbc

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

...Heureka!!!

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

You must log in to answer this question.

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