Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to join two images into one with FFmpeg? [duplicate]

Tags:

ffmpeg

tile

There are two images: a.jpg and b.jpg.

I just want to know how to join them into one image using ffmpeg.

How should I finish the ffmpeg -i a.jpg -i b.jpg command to get a c.jpg output image?

This is an example of what I am trying to achieve:

  1. a.jpg

    a.jpg

  2. b.jpg

    b.jpg

  3. c.jpg

    a.jpg and b.jpg side-by-side on one image

like image 783
n2v2rda2 Avatar asked Jul 07 '14 07:07

n2v2rda2


Video Answer


1 Answers

Use the hstack filter.

2 images:

ffmpeg -i a.jpg -i b.jpg -filter_complex hstack output.jpg

3 images:

ffmpeg -i a.jpg -i b.jpg -i c.jpg -filter_complex "[0][1][2]hstack=inputs=3" output.jpg
  • If you want to vertically stack use vstack instead.
  • See Vertically or horizontally stack several videos using ffmpeg? for more examples.
  • To change quality see How can I output a good quality JPEG image from ffmpeg?
like image 50
llogan Avatar answered Sep 18 '22 08:09

llogan