[FFmpeg-user] what's wrong with me ?

Moritz Barsnick barsnick at gmx.net
Tue Jul 15 14:16:33 CEST 2014


Hi bubibabubi,

On Mon, Jul 14, 2014 at 22:04:21 -0700, bubibabubi wrote:
> http://stackoverflow.com/questions/24604689/how-to-join-two-image-to-one-by-ffmpeg
[...]
> ffmpeg.exe -i b.jpg -i a.jpg -filter_complex scale=120:-1,tile=2x1 -s 1920x1080 out.jpeg -y

That answer on stackoverflow is totally incorrect. The tile filter
takes (two) _consecutive_ frames from _one_ stream. This command is trying to
apply it to two streams. (Well, sort of.)

Using the concat filter, you could make one stream out of your two
images:

ffmpeg -i b.jpg -i a.jpg -filter_complex 'concat,tile=2x1' -s 1920x1080 out.jpeg -y

or better

ffmpeg -i b.jpg -i a.jpg -filter_complex 'concat,tile=2x1,scale=1920x1080' out.jpeg -y

The originally given scale=120:-1 is for making the inputs have the
same size, which is important for the concat filter, but doesn't work
inside a filter_complex. So using this method with differently sized
images, you will need more magic to make them the same size.

Assuming everything is fine and you don't want to scale your output,
the basic answer according to your question is:

ffmpeg -i a.jpg -i b.jpg -filter_complex 'concat,tile=2x1' c.jpg

Álvaro's second response is totally different, and makes the inputs
into a single "image2" stream, which is also a viable solution. I think
s/he doesn't quite understand the details of ffmpeg though.

Another solution is to use the overlay filter with multiple inputs, as
outlined here:
https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos

which would turn out somewhat like this for you:
ffmpeg -i a.jpg -i b.jpg -filter_complex '[0]scale=1920:1080[sc0];[1]scale=1920:1080[sc1];[sc0]pad=iw*2:ih[pad];[pad][sc1]overlay=w' c.jpg

Have fun,
Moritz


More information about the ffmpeg-user mailing list