'FFMPEG: using filters for adding transparent watermark
how can i combine these two lines of code for adding transparent watermark (with Dynamic size)
ffmpeg -i 1.gif -i logo.png -filter_complex "[1]format=rgba,colorchannelmixer=aa=0.5[logo];[0][logo]overlay=(W-w)/2:H-h-5" -c:a copy output.gif
ffmpeg -i 1.gif -i logo.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[video][logo]overlay=(W-w)/2:H-h-5" -c:a copy output.gif
i have tried the following code:
ffmpeg -i 1.gif -i logo.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[1]format=rgba,colorchannelmixer=aa=0.5[logo];[0][logo]overlay=(W-w)/2:H-h-5" -c:a copy output.gif
i got the following Error: Filter scale2ref has an unconnected output
Solution 1:[1]
Outputs of every filter must be connected to something, and your [video]
output pad of scale2ref
is not, hence the error.
You need to feed [video]
instead of [0]
to the overlay
filter:
You need to make sure all the filter input & output pads are connected. In your case, format
and overlay
need to use the output of scale2ref
instead of reusing the input streams:
ffmpeg -i 1.gif -i logo.png \
-filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo1][video];\
[logo1]format=rgba,colorchannelmixer=aa=0.5[logo];\
[video][logo]overlay=(W-w)/2:H-h-5" \
-c:a copy output.gif
[Edit: fixed other labeling issues]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |