2

I'm a bit puzzled here and can't find an answer to the following question. Is it possible to have 2 .png files watermarked into a video in a single command line with Libavfilter?

I'm using this commandline, but everything I try to get the second PNG image in it fails.

ffmpeg –i inputvideo.avi -vf "movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]" outputvideo.flv
hakre
  • 193,403
  • 52
  • 435
  • 836
r3zfr
  • 23
  • 1
  • 3

1 Answers1

7

This is certainly possible, and should look something like:

ffmpeg –i in.avi -vf "movie=logo1.png [logo1]; movie=logo2.png [logo2]; \
[in][logo1] overlay [tmp]; [tmp][logo2] overlay=50:50" out.flv

Both logo files are read in. One's overlaid at 0,0. Then the next is overlaid at 50,50 on the output from the first overlay filter.

Using more recent versions of FFmpeg, this command could be done slightly less verbosely like so:

ffmpeg -i in.avi -i logo1.png -i logo2.png -filter_complex "overlay [tmp]; \
[tmp] overlay=50:50" out.flv

The first overlay command overlays the first two inputs (in.avi and logo1.png), and the second automatically uses the third input (logo2.png) as its second input.

blahdiblah
  • 33,069
  • 21
  • 98
  • 152
  • 1
    above command working. how to add perticular time duration showing logo in ffmpeg .(Start time and end time) video Overlay - blahdiblah if you know plz help thnx in advance – Sanket990 Feb 06 '14 at 22:18
  • I am not very much clear about your answer why and for what you have used "[tmp]" ? – Ahmad Arslan Jun 07 '16 at 11:36
  • @ArslanAhmad Its for channing multiple overlays into one, to speed up the process. – Alan Dong Jun 26 '16 at 01:26
  • @Sanket990 to add time `overlay='if(gte(t,1), 0, NAN)'` where `0` is x coordinate and `NAN` means no overlay, and `t` is time in seconds, and `1` is one second, and `gte` means greater than or equal to and commas break up conditional into the if-then pairs – Jonathan Feb 07 '18 at 00:43