6

I'm trying to overlay multiple videos into one video with ffmpeg. There is already a question with only one overlay, but I want to add multiple videos at the same time (to avoid multiple encodings).

I try to use 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 now, that the overlay area (0,366) – (720,942) is not within the main area (0,0) – (720, 210). But if I use only one overlay file alone it works.

The sizes of the videos:

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

In the result I want the a.m2v video in the top left corner (the logo) and the b.m2v as a lower third.

Community
  • 1
  • 1
xZise
  • 2,321
  • 5
  • 22
  • 31
  • See my detailed answer at [Superimposing two videos onto a static image?](http://stackoverflow.com/a/13405214/1109017). Although "static image" is mentioned the process is basically the same. – llogan Feb 04 '13 at 19:15

2 Answers2

6

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

§ overlay

Zombo
  • 1
  • 62
  • 391
  • 407
  • The first overlay is incomplete. With “overlay=592:41,overlay=0:366” it works. Also I'm interested in the reason why my solution didn't work out. – xZise Feb 04 '13 at 16:18
  • 1
    @xZise the `overlay=592:41` is strange, top left should require no argument. – Zombo Feb 04 '13 at 16:22
0

I also find a answer/workaround before 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
xZise
  • 2,321
  • 5
  • 22
  • 31