Moving FFmpeg from one pixel coordinate to another

I am trying to write a command inside FFmpeg that first puts one video stream on top of another. Then I want the overlay video to move from one pixel coordinate at a known time and later to end with another pixel coordinate.

I like the basics of -filter_complex , but I can't figure out how to use any arithmetic expressions - for example, those given here: https://www.ffmpeg.org/ffmpeg-utils.html#Expression-Evaluation

Here is an example of what I would like to accomplish.

 ffmpeg -i [INPUT1] -i [INPUT2] -filter_complex "[0:v][1:v]overlay=shortest=1:x=720:y=0:enable='between(t,10,20)'[overlay];... 

In this example, the overlay is motionless in the 720x0 pixel coordinate from 10th second to 20th second.

However, Id would like it to move to a new location in a linear fashion and end up with a different pixel coordinate.

For example, during this 10 second overlay, I would like it to start at 720x0, but then end at 1000x100.

Is it possible?

0
ffmpeg video
source share
1 answer

Is this about what you are looking for?

making a movement

This shitty example lasts 6 seconds. The red field appears after 2 seconds and ends after 3 seconds.

Example:

 ffmpeg -i bg.mp4 -i fg.mkv -filter_complex \ "[0:v][1:v]overlay=enable='between=(t,10,20)':x=720+t*28:y=t*10[out]" \ -map "[out]" output.mkv 
  • Move x from 720 to 1000 in 10 seconds. This is equal to 28 pixels per second.

  • y easy enough.

  • t is the timestamp in seconds.

  • The fg.mkv video ( fg.mkv in this example) will already last 10 seconds until it appears.

+1
source share

All Articles