Overlaying multiple videos with ffmpeg [closed]

2019-03-31 12:09发布

问题:

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.

回答1:

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



回答2:

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


标签: ffmpeg