videoffmpegvideo-processingtranscode

Two videos playing, how to crop the second video in FFmpeg


I'm totally new to FFmpeg and I'm still learning.

I've been trying to combine two videos into one. Where there is a "main" video that plays and a secondary video that is much smaller in the corner.

I have managed to figure out almost everything on my own except for how to crop the smaller corner video by half. My goal is to crop/cut the corner video so it will only show the right half of the video but I can't seem to make it work, any help/tips would be much appreciated!

ffmpeg -ss 00:04:10.10 -i corner.m4v -vf "movie=main.mkv [in1]; [in]scale=iw/4:ih/4, pad=0*iw:ih[in0]; [in1][in0] overlay=main_w/1.334:550 [out]" -b:v 3500k out.mkv

The above is what I currently have that works, the only thing that is missing is cropping the corner video.


Solution

  • ffmpeg -i main.mkv -ss 00:04:10.10 -i corner.m4v -filter_complex "[1]scale=iw/4:-1,crop=iw/2:ih:ow:0[corner];[0][corner]overlay=main_w-overlay_w-10:10" output.mkv