62

I have the need to apply fadein and overlay filters to a video. Is it possible to apply 2 filters at once?

I got:

ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10 [out]" output.mpg

I'm trying to add fade=in:0:20, but if I add a new -vf parameter, it will overwrite the preceding one, and if I add:

-vf "fade=in:0:20; movie=......"

it won't work.

Is this possible or do I have to run FFmpeg twice?

Chamath
  • 1,650
  • 2
  • 18
  • 30
Parziphal
  • 4,604
  • 3
  • 28
  • 29

2 Answers2

80

Okay, someone helped me somewhere.

I had to separate filters with commas:

ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10, fade=in:0:20 [out]" output.mpg

This will apply fadein to both the watermark and the video.

Parziphal
  • 4,604
  • 3
  • 28
  • 29
  • 2
    I am currently trying this with `mencoder -vf "rotate=180,flip" -o out.avi -oac mp3lame -ovc lavc in.mp4` but it doesn't work. Any hints? – Martin Thoma Mar 28 '12 at 22:41
23

Yes it is possible .

ffmpeg.exe -i yourvideo.avi -vf "[in] scale=iw/2:ih/2, pad=iw+40:ih+40:10:10 [top]; movie=yourLogoOrVideo.pngOraviEtc, scale=iw/2:ih/2 , fade=out:400:40:alpha=1 [bottom]; [top][bottom] overlay=PaddingFromTop:PaddingFromLeft [out]" -f flv ff.flv
Emre Karataşoğlu
  • 1,545
  • 14
  • 23
  • 1
    what does the the real filter graph look like? does ffmpeg actualy to it in this order? if you were going to crop, unsharp, denoise, etc – μολὼν.λαβέ Mar 09 '17 at 20:37
  • 3
    I've found out that yes, ffmpeg applies the filters in the order specified; thus it's not a good idea to e.g. hardsub subtitles first and then apply sharpening filter, e.g. like this: `-vf "scale=1920:1080 , subtitles=subtitles.ass , unsharp=3.0:3.0:1.5"` (that's how I found it out accidentally) – edison23 May 17 '18 at 14:59