I am asking this question, as i couldn't find anything similar to my problem. I would like to read different image sequence streams and put it "thumbnailed" to a new image stream.

From the example image below, you see that i am reading different image sequences to compose a thumbnailed big image stream.

Is it possible to solve this with just ffmpeg commands???


enter image description here

  • 1
    Not sure I understand you, but take a look at this. Is this what you want? That is, without the other filtering options- just the scaling and overlaying?
    – Rajib
    Mar 2, 2014 at 11:35
  • This seems quite close, i will have a look into this. (apart from applying fitlers) Mar 2, 2014 at 11:38
  • Is it possiblet o apply this grid, without adding filter effects? Mar 2, 2014 at 12:35
  • Do you mean the blue dividing lines? You could put all four videos on top of a blue background.
    – Rajib
    Mar 2, 2014 at 13:54
  • no no, on the page you gave me, the syntax is like -filter_complex "[0:0]pad=iw*2:ih*2[a]; but i don't want to apply any effects on it, just arrange them into this grid Mar 2, 2014 at 16:16

1 Answer 1


The way to put 4 image streams would be:

ffmpeg -y -i input1.mp4 -i input2.mp4 -i input3.mp4 -i input4.mp4 -filter_complex "[0:0]pad=iw*2:ih*2[a];[a][1:0]overlay=w[x];[x][2:0]overlay=0:h[y];[y][3:0]overlay=w:h" -strict -2 output.mp4  

This does not use any other filter, it uses the pad to decrease the size, and then the overlay filter to lay it on at four pixel positions. But in the filter chain it has to do this several times, combining the effects of the first 2 inputs, then overlaying on the third and then on the fourth.

I have used mp4 container but it can work for other containers. You will not need -strict -2 under most circumstances- here it is used because my ffmpeg defaults to aac audio encoder for mp4.

If there is no audio which is very likely in your case, again you will not need the -strict -2 option. If you do have audio as an input but do not want to use it in the output, add the parameter -an in the command.

Alternatively, and this is a good option, use the map option:

ffmpeg -y -i input1.mp4 -i input2.mp4 -i input3.mp4 -i input4.mp4 -filter_complex "[0:0]pad=iw*2:ih*2[a];[a][1:0]overlay=w[x];[x][2:0]overlay=0:h[y];[y][3:0]overlay=w:h[v]" -map '[v]' output.mp4

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .