sorry if my question is not exactly the correct format, this is my first post here
I have created a ffmpeg one line code that will fade in and fade out a transparent .png as a overlay
here is my code:
bin\ffmpeg -t 10 -i "video w bottom.mp4" -i "utube watermark.png" -filter_complex "[1:v]format=rgba,geq=r='r(X,Y)':a='0.75*alpha(X,Y)',scale=150:150,zoompan=d=25*4:d=125:s=150x150,fade=in:st=2:d=1:alpha=1,fade=out:st=4:d=1:alpha=1[im];[0][im]overlay=10:10:enable='between(t,0,5)'" -c:a copy preview.mp4
now this works great! BUT... the issue i am having is if i try and change up the here:
fade=out:st=4
and enable='between(t,0,5)
then it no longer fades out correctly if say i change it to:
fade=out:st=5
and enable='between(t,0,6)
EDIT: Here is the final code with with the info i got from @Gyan (I am sure can be cleaned up better)
SET /A overlayStart=2
SET /A overlayLength=6
SET /A fadeInDuration=1
SET /A fadeOutDuration=1
SET /A fps=30
SET /A startOverlayFadeIn=%overlayStart%
SET /A startOverlayFadeOut=%overlayStart%+%overlayLength%
SET /A betweenEnding=%startOverlayFadeOut%+%fadeInDuration%
SET /A overlayFullLength=%overlayStart%+%overlayLength%+%fadeInDuration%+%fadeOutDuration%
SET /A dur=%overlayFullLength%+4
bin\ffmpeg -t %dur% -i "video w bottom.mp4" -i "utube watermark.png" -filter_complex "[1:v]format=rgba,geq=r='r(X,Y)':a='0.75*alpha(X,Y)',scale=150:150,zoompan=d=%fps%*%overlayFullLength%:s=150x150,fade=in:st=%startOverlayFadeIn%:d=%fadeInDuration%:alpha=1,fade=out:st=%startOverlayFadeOut%:d=%fadeOutDuration%:alpha=1 [im];[0][im]overlay=10:10:enable='between(t,0,%dur%)'" -c:a copy preview.mp4
Hope this helps someone else out and/or they can expand on this