3

I'd like to combine three videos into one vertically stacked video. The three videos have different width and height.

I can combine them horizontally successfully with this command:

ffmpeg -i s1.mp4 -i s2.mp4 -i temp.mp4 -filter_complex "[1:v][0:v]scale2ref=oh*mdar:ih[1v][0v];[2:v][0v]scale2ref=oh*mdar:ih[2v][0v];[0v][1v][2v]hstack=3,scale='2*trunc(iw/2)':'2*trunc(ih/2)';[0:a:0][1:a:0][2:a:0] amix=inputs=3:duration=first:dropout_transition=0,dynaudnorm" final.mp4

How can I modify this command to stack them vertically?

1 Answer 1

0

For vertical stacking, the widths have to be equalized.

[1:v][0:v]scale2ref=iw:ow/mdar[1v][0v];[2:v][0v]scale2ref=iw:ow/mdar[2v][0v];[0v][1v][2v]vstack=3

2
  • oh it works,thx!
    – Jesus Slim
    Commented Nov 22, 2018 at 6:37
  • 1
    @Gyan can you explain the parts of the above string?
    – maurice
    Commented Dec 29, 2020 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.