0

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.

Rorlingur
  • 3
  • 3

1 Answers1

0
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
  • No need for movie source filter.
  • scale, crop, and overlay can use parameters that refer to the input and output sizes.
llogan
  • 121,796
  • 28
  • 232
  • 243
  • Oh, you are right! This solution is more elegant, I hadn't tested out filter_complex enough, Thank you! I was going to ask about mixing audio of the videos together but I figured it out. Gonna leave this code here in-case anyone in the future might have a similar problem. `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], amix=inputs=2[a];[0][corner]overlay=main_w-overlay_w-10:10" -map 0:v -map "[a]" output.mkv` If I'm doing something wrong with the map/amix then I welcome any criticism :) – Rorlingur Jan 14 '21 at 23:16
  • @Rorlingur Only changes I'd make are `[corner], amix` to `[corner]; amix`, or if you don't want to rely on amix to guess the inputs you can use `[corner];[0:a][1:a]amix`. And `overlay_w-10:10" -map 0:v` to `overlay_w-10:10[v]" -map "[v]"` (or omit mapping and use default behavior. See [filtering introduction](https://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction) for a brief overview. – llogan Jan 14 '21 at 23:42