How to add watermark in a gif with ffmpeg?

2020-05-01 07:13发布

I'm creating a gif using this:

ffmpeg -v warning -i in.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,palettegen" -y palette.png
ffmpeg -v warning -i in.mp4 -i palette.png -lavfi "fps=10,scale=320:-1:flags=lanczos,paletteuse=dither=bayer:bayer_scale=3 [x]; [x][1:v] paletteuse" -y out.gif

Where should I put this:

-i watermark.png -filter_complex "overlay=W-w-5:H-h-5"

to add the watermark in my gif?

标签: ffmpeg
1条回答
时光不老,我们不散
2楼-- · 2020-05-01 07:24

Use -filter_complex instead of -vf:

ffmpeg -i in.mp4 -i watermark.png -filter_complex "[0]fps=10,scale=320:-1:flags=lanczos[bg];[bg][1]overlay=W-w-5:H-h-5,palettegen" palette.png
ffmpeg -i in.mp4 -i watermark.png -i palette.png -filter_complex "[0]fps=10,scale=320:-1:flags=lanczos[bg];[bg][1]overlay=W-w-5:H-h-5[x];[x][2]paletteuse=dither=bayer:bayer_scale=3" output.gif
查看更多
登录 后发表回答