Overlay multiple videos with ffmpeg

I am trying to overlay multiple videos into one video using ffmpeg. You already have a question with only one overlay , but I want to add several videos at the same time (to avoid several encodings).

I am trying to use the following line:

ffmpeg -i background.m2v -vf "movie=a.m2v [a]; movie=b.m2v [b]; [in][a] overlay=0:366, [b] overlay=592:41" combined.m2v 

The error is that the overlap area (0.366) - (720.942) is not in the main area (0,0) - (720, 210). But if I use only one overlay file, it works.

Video Sizes:

  • background: 720x576
  • a.m2v: 72x48
  • b.m2v: 720x210

As a result, I want a.m2v video in the upper left corner (logo) and b.m2v as the lower third.

+4
source share
2 answers

I tested this with mp4 , but m2v should work as well

 set 'overlay, overlay = 0:366' ffmpeg -i background.mp4 -i a.mp4 -i b.mp4 -filter_complex "$1" combined.mp4 

& sect; overlay

+4
source

I also found the answer / workaround in front of svnpenn:

 ffmpeg -i background.m2v -vf "movie=a.m2v [a]; movie=b.m2v [b]; [in][a] overlay=0:366 [c]; [c][b] overlay=592:41" combined.m2v 
0
source

All Articles