3

I have three videos s1.mp4,s2.mp4 s3.mp4 and I need to combine three videos side by side I know use hstack but my three videos has different size?

I've found following commands.It works,but only support two videos.

ffmpeg -i s1.mp4 -i s2.mp4 -filter_complex "[1:v][0:v]scale2ref[wm][base];[base][wm]hstack=2" final.mp4

1 Answer 1

5

Use

ffmpeg -i s1.mp4 -i s2.mp4 -i s3.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)'" final.mp4
3
  • I tried with this code,strill without any luck [libx264 @ 0x7f9334838e00] width not divisible by 2 (637x160) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height @Gyan
    – gs z
    Commented Nov 8, 2018 at 5:31
  • Added filter at end
    – Gyan
    Commented Nov 8, 2018 at 6:11
  • Can you tell me How to use "VSTACK" in this case? @Gyan
    – gs z
    Commented Nov 14, 2018 at 11:04

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.