[FFmpeg-user] Merge two videos into one with side-by-side composition

John Crossman johncrossman at berkeley.edu
Thu Jun 20 00:55:42 CEST 2013


On Fri, Jun 14, 2013 at 6:39 PM, Lou <lou at lrcd.com> wrote:

> My original example assumed that your inputs were the same frame size.
> Your inputs vary in size, and your padding was based on the smaller
> input, so your larger input was not fitting correctly.
>
> You can pad from the larger video and center the smaller video in the
> padded area (you should check the arithmetic since it's Friday and I
> just got off of work):
>
> ffmpeg -i camera.mpg -i screen.mpg -filter_complex \
> "[1:v]pad=iw*2:ih[bg];[bg][0:v]overlay=W/2+((W/2-w)/2):(H-h)/2" \
> -qscale:v 2 output.mpg
>
> Or you could add the scale filter make the inputs a more similar size.
>


Thanks! That tip is a big help. One remaining question:

The resulting video has no audio. There are two ways I could modify ffmpeg
command to get the audio I need:

   1. tell ffmpeg to use audio of one of the input videos
   2. pass in a third input which is the audio stream

My preference is option #1. Is there an easy answer here?

Thanks again.


More information about the ffmpeg-user mailing list