How to add a watermark as a loop using ffmpeg sliding overlay
Solution 1:
Use
ffmpeg -i test.mkv -loop 1 -i watermark.png \
-filter_complex "overlay=x=0:y='if(gte(t,0), ((H+h)\/5)\*mod(t\,5)-h, NAN)':shortest=1" \
output.mkv
5 seconds is the period of the above expression. Change both 5
s to alter the period.
Unless you're working with files with negative timestamps such as segmented or files split using ffmpeg -ss
in copy
mode, you can skip the gte
function.
ffmpeg -i test.mkv -loop 1 -i watermark.png \
-filter_complex "overlay=x=0:y='((H+h)\/5)\*mod(t\,5)-h':shortest=1" \
output.mkv