FFmpeg learning (6) - video splicing

FFmpeg command using filter_complex stitching multiple videos

filter_complex splicing a plurality of video, each video while playing, such as a sound effect with the screen.

Two video splicing
1. transverse splicing

ffmpeg -i out1.mp4 -i out2.mp4 -filter_complex "[0:v]pad=iw*2:ih*1[a];[a][1:v]overlay=w" out.mp4

// pad is synthesized video width and height, where iw represents the first video width, the width of the video representative synthesis iw * 2 doubled, the IH of a video is high, the best resolution video synthesizing two consistent. overlay covering, [a] [1: v] overlay = w, on behalf of the covering position behind w: 0

2. The vertical screen display

ffmpeg -i out1.mp4 -i out2.mp4 -filter_complex "[0:v]pad=iw:ih*2[a];[a][1:v]overlay=0:h" out.mp4

Three video splicing
1. transverse splicing

ffmpeg -i out1.mp4 -i out2.mp4 -i out3.mp4 -filter_complex "[0:v]pad=iw*3:ih*1[a];[a][1:v]overlay=w[b];[b][2:v]overlay=2.0*w" out.mp4 

2. Vertical stitching

ffmpeg -i out1.mp4 -i out2.mp4 -i out3.mp4 -filter_complex "[0:v]pad=iw:ih*3[a];[a][1:v]overlay=0:h[b];[b][2:v]overlay=0:2.0*h" out.mp4

Video four 2x2 arrayed

ffmpeg -i out1.mp4 -i out2.mp4 -i out3.mp4 -i out4.mp4 -filter_complex "[0:v]pad=iw*2:ih*2[a];[a][1:v]overlay=w[b];[b][2:v]overlay=0:h[c];[c][3:v]overlay=w:h" out.mp4

 

Published 295 original articles · won praise 37 · views 30000 +

Guess you like

Origin blog.csdn.net/tianshan2010/article/details/104737576