0

I need to make a flip video and add 2 watermarks, my script doesn't work for some reason (the script just flips the video, but does not apply watermarks).

ffmpeg -i input.mp4 -i watermark.png -i watermark2.png -filter_complex "hflip;[1:v]scale=iw*0.5:-1[top];[2:v]scale=iw*0.1:-1[top2];[0:v][top]overlay=x=(W-w)/40:y=(H-h)/40[tmp];[tmp][top2]overlay=5:H-h-5" -preset superfast output.mp4

1 Answers1

0

We have to store the output of hflip with a temporary name (like [v0]), and use it later as input to the overlay filter:

ffmpeg -y -i input.mp4 -i watermark.png -i watermark2.png -filter_complex "[0:v]hflip[v0];[1:v]scale=iw*0.5:-1[top];[2:v]scale=iw*0.1:-1[top2];[v0][top]overlay=x=(W-w)/40:y=(H-h)/40[tmp];[tmp][top2]overlay=5:H-h-5" -preset superfast output.mp4


In the original command hflip; is mapped to the output video, because it has no output sink.
By default FFmpeg maps the first video without a sink to the output.

  • [0:v]hflip[v0] - horizontally flip the video of the first input, and store the result in [v0].
  • [v0][top]overlay... - Overlays [top] on top of [v0].
Rotem
  • 3,346