0

I am trying to join a series of videos in a grid. Here is a command I used for 3 videos.

ffmpeg -y -i /mnt/labserver/vid1.mp4 -i /mnt/labserver/vid2.mp4 -i /mnt/labserver/vid3.mp4 -filter_complex "color=s=360x360:c=Black [nbase];[0:v]setpts=PTS-STARTPTS,scale=180x180[b0];[1:v]setpts=PTS-STARTPTS,scale=180x180[b1];[nbase][b0]overlay=shortest=1:x=0:y=180[temp0];[temp0][b1]overlay=repeatlast=1:x=0:y=360[temp1];[temp1][b2]overlay=repeatlast=1:x=0:y=540[temp2]" -c:v libx264 -pix_fmt yuv420p /mnt/labserver/videos_joined.mp4

I get the following error

Invalid stream specifier: b2

As far as I recall this has previously worked for me. Could someone tell me what could be wrong here and whether perhaps the error depends on the FFmpeg version?

Thank you!!

Adam Gosztolai
  • 242
  • 1
  • 3
  • 14
  • 1
    See [Vertically or horizontally stack (mosaic/grid) several videos using ffmpeg](https://stackoverflow.com/a/33764934/1109017) for a faster, easier method. – llogan Mar 31 '20 at 17:28

1 Answers1

1

You are getting an error because there is no b2 that used as an intermediate output in the filters sequence.

You probably meant using [2:v] instead of [b2]:

ffmpeg -y -i vid1.mp4 -i vid2.mp4 -i vid3.mp4 -filter_complex "color=s=360x360:c=Black [nbase];[0:v]setpts=PTS-STARTPTS,scale=180x180[b0];[1:v]setpts=PTS-STARTPTS,scale=180x180[b1];[nbase][b0]overlay=shortest=1:x=0:y=180[temp0];[temp0][b1]overlay=repeatlast=1:x=0:y=360[temp1];[temp1][2:v]overlay=repeatlast=1:x=0:y=540[temp2]" -map "[temp2]" -c:v libx264 -pix_fmt yuv420p videos_joined.mp4

I also added -map "[temp2]" for mapping temp2 as output.

I am not getting a grid as an output...

Rotem
  • 30,366
  • 4
  • 32
  • 65