Answers.Body: <p>In zoompan, you have set <code>d=125</code> so @ 25 fps, zoompan will create a 5-second stream.</p>
  <p>Thus there are no frames after 5s for the fade to be applied to. The duration of the stream should be enough to cover the <em>end</em> of the fade transition. For <code>st=5:d=1</code>, total duration should be <code>5+1</code>=<code>6</code> or more.</p>
  <p>Change to <code>d=150</code>.</p>
  <p>P.S. In <code>d=25*4:d=125</code> the first <code>d=VALUE</code> is overridden by the 2nd one, so it is useless.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-14T08:06:46.460Z
Answers.Text: I will make a edit of the full code in the OP in case this can help someone else. Thank you
Answers.UserDisplayName: hammer head down
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-14T21:38:17.687Z
Answers.Text: how can i set this up to run  by say 2-3 times?  from a variable i set of %c% times? do i need to ask a new question? @gyan
Answers.UserDisplayName: hammer head down
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-14T06:40:55.210Z
Answers.LastActivityDate: 2020-12-14T06:40:55.210Z
Answers.UserDisplayName: Gyan
Body: <p>sorry if my question is not exactly the correct format, this is my first post here</p>
  <p>I have created  a ffmpeg one line code that will  fade in and fade out a transparent .png as a overlay</p>
  <p>here is my code:</p>
  <pre><code>bin\ffmpeg -t 10 -i &quot;video w bottom.mp4&quot; -i &quot;utube watermark.png&quot; -filter_complex &quot;[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)'&quot; -c:a copy preview.mp4
  </code></pre>
  <p>now this works great!  BUT...  the issue i am having is if i try and change up the here:</p>
  <p><code>fade=out:st=4</code>  and <code>enable='between(t,0,5)</code></p>
  <p>then it no longer fades out correctly if say i change it to:</p>
  <p><code>fade=out:st=5</code>  and <code>enable='between(t,0,6)</code></p>
  <p>EDIT:
  Here is the final code with with the info i got from @Gyan (I am sure can be cleaned up better)</p>
  <pre><code>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 &quot;video w bottom.mp4&quot; -i &quot;utube watermark.png&quot; -filter_complex &quot;[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%)'&quot; -c:a copy preview.mp4
  </code></pre>
  <p>Hope this helps someone else out and/or they can expand on this</p>
  
Tags: <ffmpeg><windows>
Title: FFMPEG fade out image overlay issue on windows 10
UserDisplayName: hammer head down
ThreadText: # FFMPEG fade out image overlay issue on windows 10
  
  (Asked by: username_0 on 2020-12-14)
  
  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 @username_1 (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
  
  **Tags:** ffmpeg, windows
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-12-14. Score: 0 | Accepted answer
  
  In zoompan, you have set `d=125` so @ 25 fps, zoompan will create a 5-second stream.
  
  Thus there are no frames after 5s for the fade to be applied to. The duration of the stream should be enough to cover the *end* of the fade transition. For `st=5:d=1`, total duration should be `5+1`=`6` or more.
  
  Change to `d=150`.
  
  P.S. In `d=25*4:d=125` the first `d=VALUE` is overridden by the 2nd one, so it is useless.
  
  > **Comments:**
  > **username_0**: I will make a edit of the full code in the OP in case this can help someone else. Thank you  
  > **username_0**: how can i set this up to run  by say 2-3 times?  from a variable i set of %c% times? do i need to ask a new question? @username_1  
  
  ---
  
  