0

I am trying to have an output video using ffmpeg with:

  • a base video "video.mp4"
  • a static overlay image "staticimage.png"
  • an overlay image that makes looping transition left-right "movingimage.png"

Here is what I could make so far:

ffmpeg -i "video.mp4" -i "movingimage.png" -i "staticimage.png" -filter_complex "[0]overlay=x='if(gte(t,0), -w+(t)*100, 3)':y=0[v];[v][2]overlay=0:0[vt];[1][vt]overlay=0:0" -c:a copy -vcodec libx264 -preset superfast -f flv "output.flv"

This command is successful so far. However the moving image only does one transition. Is there a way to make it loop and start all over again for the initial position (left)?

Your help will be appreciated. Thank you.

1 Answer 1

0

For looping, you want a periodic function, usually mod.

In this case,

x='-w+100*mod(t,(W+w)/100)'
1
  • Works like a charm, thank you very much.
    – Gintal
    Commented Feb 6, 2020 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .