If you can handle some scripting, try AviSynth.
AviSynth outputs .avi video, which can be encoded by your favourite encoder. eg. VirtualDub.
Below is sample script which takes a single file and chops it up into four panels, which are then surrounded by blue margins.
It can just as easily handle four different video sources.
AviSynth is a very powerful tool, but scripting does not suit everyone.
Mg=8 # Margin: # must be a multiple of 4
hM=Mg/2 # half Margin # must be an even number
pane1H=((inVid.height/8)/2)*2 # round it to an even number
pane1W=((inVid.width )/2)*2 # round it to an even number
pane2H=((inVid.height/2)/2)*2 # round it to an even number
pane2W=((inVid.width /3)/2)*2 # round it to an even number
pane4H=((inVid.height-pane2H-pane1H)/2)*2 # round it to an even number
#### Crop( clip ,Left ,Top ,-Right ,-Bottom ).AddBorders( L ,T ,R ,B ,Colour )
pane1 =Crop( inVid ,0 ,0 ,-0 ,-pane2H-pane4H ).AddBorders( Mg ,Mg ,Mg ,hM ,$00ffff )
pane2 =Crop( inVid ,0 ,pane1H ,-pane3W-hM ,-pane4H ).AddBorders( Mg ,hM ,hM ,hM ,$00ffff )
pane3 =Crop( inVid ,pane2W+hM ,pane1H ,-0 ,-pane4H ).AddBorders( hM ,hM ,Mg ,hM ,$00ffff )
pane4 =Crop( inVid ,0 ,pane1H+pane3H ,-0 ,-0 ).AddBorders( Mg ,hM ,Mg ,Mg ,$00ffff )
out=StackVertical(row1, StackVertical(row2, row3))