I'm trying to watermark a video using FFMPEG and would like the watermark to fade in.

The following code adds the watermark however the fade in effect is applied to the entire video and not just the watermark.

ffmpeg -loop 1 -t 3 -i background.png -i silence.mp3 -shortest -s 640x360 -vf "movie=watermark.png [watermark]; [in] [watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2,fade=in:0:30 [out]" -y output.mpg

I've searched online but have been unable to find a good example on how to apply the fade in only to the overlay.

  • Can you try setting the fade=in:0:30 directly after movie=watermark.png instead? – slhck Mar 18 '13 at 11:31
  • @slhck, I tried -vf "movie=watermark.png,fade=in:0:30 [watermark]; [in] [watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out] but unfortunately the watermark does not appear anymore. – Dale Zak Mar 18 '13 at 15:15

What you're doing is not wrong, but not recommended.

Try using this:

ffmpeg -y -pix_fmt rgb32 -f rawvideo -s 640x360 -i /dev/zero -vf 'movie=watermark.png[watermark];[in][watermark]overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2,fade=in:0:30[out]' -r 30 -t 3 output.mpg

I will explain:

  • Start from an empty source: -pix_fmt rgb32 -f rawvideo -s 640x360 -i /dev/zero
  • load the watermark filter: 'movie=watermark.png[watermark];[in][watermark]overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2,fade=in:0:30[out]
  • set the frame rate: -r 30
  • set the duration (in seconds): -t 3
  • output to file (and format): output.mpg

I hope that helps. E

  • Thanks E.G. for your answer, works great creating a black background. Is there anyway to have the watermark fade in with a white background? – Dale Zak Jun 6 '13 at 20:08

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.