some_user
some_user

Reputation: 179

ffmpeg - offset cropped part of a video

Problem:

-------------------------
|   -------             |
|   |vid2 |             |
|   |     |    vid1     |
|   -------             |
|                       |
|                       |
|                       |
-------------------------

For the cropping part, I figured using the crop-option might work, but I don't quite know, how to put the video back together, so that the cropped part of the video ends up at the same place as before, i.e. how to set the position, while overlaying the 2 videos.

Upvotes: 0

Views: 396

Answers (1)

Gyan
Gyan

Reputation: 93369

Let's say the vid2 window is 2.5 seconds late, is of size WxH and is located at (X,Y) from top-left corner of full frame.

You would use

ffmpeg -i input -vf "split=2[v1][v2];[v2]trim=2.5,setpts=PTS-STARTPTS,crop=W:H:X:Y[v2];[v1][v2]overlay=X:Y" -c:a copy out.mp4

Upvotes: 1

Related Questions