Body: <p>my goal is to do this with ffmpeg complex_filters:</p>
  <p>I have a background 1080 vid and like to slide in some overlay graphics and texts. So my input is the vid and 3 jpg files. The jpg files should slide in to a position over the background-video, fade in in the same time, stay for a few seconds and then fade out. Then the same thing should be displayed with the second and third jpg. Additionally, a text should be displayed.</p>
  <p>My main problem is, that the left-to right transition works only on the first jpg, not the second or third one. The second and third one does the fade-in, but not the slide. All other things work, it's just the &quot;slide in&quot; of the second and third jpg that is ignored after rendering.</p>
  <p>My command is:</p>
  <pre><code>ffmpeg -i concat-video.mp4  -loop 1 -i card1.jpg -loop 1 -i card2.jpg -loop 1 -i card3.jpg -filter_complex &quot;[0:v] drawtext=alpha='
  
      # The transition in this block works
      if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,10.5),1,if(lt(t,12.0),(1.5-(t-10.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title1:x=100:y=100 [cardset1];
      [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=0:d=1.5:alpha=1 [fadeIn1];
      [cardset1][fadeIn1] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,0,1.5)':shortest=1 [slideIn1];
      [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=3.5:d=1.5:alpha=1 [display1];
      [slideIn1][display1] overlay=300:300:enable='between(t,1.5,8.0)':shortest=1 [fadeOut1];
      [fadeOut1] drawtext=alpha='if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,3.5),1,if(lt(t,5.0),(1.5-(t-3.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 1:x=200:y=200 [final1];
      
      # The transition in this block don't work, only fade-in
      [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=6:d=1.5:alpha=1 [fadeIn2];
      [final1][fadeIn2] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,6,7.5)':shortest=1 [slideIn2];
      [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=9.5:d=1.5:alpha=1 [display2];
      [slideIn2][display2] overlay=300:300:enable='between(t,7.5,14.0)':shortest=1 [fadeOut2];
      [fadeOut2] drawtext=alpha='if(lt(t,6),0,if(lt(t,7.5),(t-6)/1.5,if(lt(t,9.5),1,if(lt(t,11.0),(1.5-(t-9.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 2:x=200:y=200 [final2];
      
      # The transition in this block don't work too, only fade-in
      [final2] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,17.5),1,if(lt(t,19.0),(1.5-(t-17.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title2:x=100:y=100 [cardset2];
      [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=12:d=1.5:alpha=1 [fadeIn3];
      [cardset2][fadeIn3] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,12,13.5)':shortest=1 [slideIn3];
      [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=15.5:d=1.5:alpha=1 [display3];
      [slideIn3][display3] overlay=300:300:enable='between(t,13.5,20.0)':shortest=1 [fadeOut3];
      [fadeOut3] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,15.5),1,if(lt(t,17.0),(1.5-(t-15.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 3:x=200:y=200 [final3];
      
  &quot; -pix_fmt yuva420p -map &quot;[final3]&quot; output.mp4
  </code></pre>
  <p>I've tried several thing, but nothing helped. So i hope somebody here can help me :)</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-19T04:59:54.230Z
Comments.Text: time `...(t-6)*1065...(t-6)...`
Comments.UserDisplayName: Баяр Гончикжапов
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-22T09:37:43.297Z
Comments.Text: @БаярГончикжапов thank you, that worked!
Comments.UserDisplayName: Nimderp
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-12-23T14:06:29.417Z
Comments.Text: @БаярГончикжапов - can you please post your comment as a fuller answer. Then Nimderp can accept it, it'll get upvotes and future visitors will be able to easily see the answer.
Comments.UserDisplayName: Dr Mayhem
Tags: <ffmpeg>
Title: Left-to right transition on overlay works only on first one in chain, not second one
UserDisplayName: Nimderp
ThreadText: # Left-to right transition on overlay works only on first one in chain, not second one
  
  (Asked by: username_0 on 2023-12-18)
  
  my goal is to do this with ffmpeg complex\_filters:
  
  I have a background 1080 vid and like to slide in some overlay graphics and texts. So my input is the vid and 3 jpg files. The jpg files should slide in to a position over the background-video, fade in in the same time, stay for a few seconds and then fade out. Then the same thing should be displayed with the second and third jpg. Additionally, a text should be displayed.
  
  My main problem is, that the left-to right transition works only on the first jpg, not the second or third one. The second and third one does the fade-in, but not the slide. All other things work, it's just the "slide in" of the second and third jpg that is ignored after rendering.
  
  My command is:
  
  ```
  ffmpeg -i concat-video.mp4  -loop 1 -i card1.jpg -loop 1 -i card2.jpg -loop 1 -i card3.jpg -filter_complex "[0:v] drawtext=alpha='
  
      # The transition in this block works
      if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,10.5),1,if(lt(t,12.0),(1.5-(t-10.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title1:x=100:y=100 [cardset1];
      [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=0:d=1.5:alpha=1 [fadeIn1];
      [cardset1][fadeIn1] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,0,1.5)':shortest=1 [slideIn1];
      [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=3.5:d=1.5:alpha=1 [display1];
      [slideIn1][display1] overlay=300:300:enable='between(t,1.5,8.0)':shortest=1 [fadeOut1];
      [fadeOut1] drawtext=alpha='if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,3.5),1,if(lt(t,5.0),(1.5-(t-3.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 1:x=200:y=200 [final1];
      
      # The transition in this block don't work, only fade-in
      [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=6:d=1.5:alpha=1 [fadeIn2];
      [final1][fadeIn2] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,6,7.5)':shortest=1 [slideIn2];
      [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=9.5:d=1.5:alpha=1 [display2];
      [slideIn2][display2] overlay=300:300:enable='between(t,7.5,14.0)':shortest=1 [fadeOut2];
      [fadeOut2] drawtext=alpha='if(lt(t,6),0,if(lt(t,7.5),(t-6)/1.5,if(lt(t,9.5),1,if(lt(t,11.0),(1.5-(t-9.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 2:x=200:y=200 [final2];
      
      # The transition in this block don't work too, only fade-in
      [final2] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,17.5),1,if(lt(t,19.0),(1.5-(t-17.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title2:x=100:y=100 [cardset2];
      [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=12:d=1.5:alpha=1 [fadeIn3];
      [cardset2][fadeIn3] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,12,13.5)':shortest=1 [slideIn3];
      [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=15.5:d=1.5:alpha=1 [display3];
      [slideIn3][display3] overlay=300:300:enable='between(t,13.5,20.0)':shortest=1 [fadeOut3];
      [fadeOut3] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,15.5),1,if(lt(t,17.0),(1.5-(t-15.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 3:x=200:y=200 [final3];
      
  " -pix_fmt yuva420p -map "[final3]" output.mp4
  
  ```
  
  I've tried several thing, but nothing helped. So i hope somebody here can help me :)
  
  **Tags:** ffmpeg
  
  > **Comments:**
  > **username_1**: time `...(t-6)*1065...(t-6)...`  
  > **username_0**: @username_1 thank you, that worked!  
  > **username_2**: @username_1 - can you please post your comment as a fuller answer. Then username_0 can accept it, it'll get upvotes and future visitors will be able to easily see the answer.  
  
  ---
  
  ## 0 answers
  
  