How can I tile videos/create a video montage?

前端 未结 4 2048
情歌与酒
情歌与酒 2021-02-10 10:08

I have four videos that I would like to tile in a 2x2 fashion to make a new video. Is there a way I can do this easily, preferably free and under Linux? I am willing to progra

4条回答
  •  时光说笑
    2021-02-10 10:58

    The following ffmpeg command will do exactly what the questioner wanted:

    ffmpeg -i input1.mp4 -i input2.mp4 -i input3.mp4 -i input4.mp4 -filter_complex \
    '[0:v]pad=iw*2:ih*2:0:0[int2];[int2][1:v]overlay=0:H/2[int3];[int3][2:v]overlay=W/2:0[int4];[int4][3:v]overlay=W/2:H/2[out]' \
    -map [out] -c:v libx264 -crf 23 -preset veryfast output.mp4
    

    First, the pad filter doubles the size of the first input video, leaving the original video in the top-left corner. The serial overlay filters then place the other inputs over the the black padding added by the pad filter.

    If the videos are of different resolutions, the command will require some modification.

提交回复
热议问题