How to push one video out as another comes in with FFMPEG?

1

I'm trying to achieve a sliding animation effect with ffmpeg where the current input is pushed out to the left, while the next input pulls into the screen from the right.

So far, I have this command, which achieves the latter part of the effect using the overlay filter.

ffmpeg -y -i /tmp/temp_videos/0000.mp4 -itsoffset 5 -i /tmp/temp_videos/0001.mp4 -filter_complex "[0:v]setpts=PTS-STARTPTS[v0]; \
[1:v]setpts=PTS-STARTPTS+7/TB[v1]; \
[v0][v1]overlay=x='if(gte(w-(t-7)*2000,0),w-(t-7)*2000,0)':y=0[out]" -map '[out]' -y test.mp4

It takes two input video files and overlays the second on top of the first. After 7 sec, the second input slides in from the right, covering up the first input. The x position of the second input starts offscreen and decreases until it goes to 0. Like I said, this is the second half of the animation effect I am trying to achieve.

How can I make it so that the first input is pushed out to the left as the second one comes in?

This is almost exactly the effect I am looking for except moving in the opposite direction: https://github.com/tanersener/ffmpeg-video-slideshow-scripts/raw/master/docs/transition_push_horizontal.gif

The Unknown Dev

Posted 2019-03-20T14:47:24.933

Reputation: 615

No answers