ffmpeg -re -i input1.mp4 -i input2.mp4 -i input3.mp4 -i input4.mp4\
-filter_complex "nullsrc=size=640x480 [base];\
[0:v] setpts=PTS-STARTPTS,scale=320x240 [upperleft]; \
[1:v] setpts=PTS-STARTPTS,scale=320x240 [upperright]; \
[2:v] setpts=PTS-STARTPTS,scale=320x240 [lowerleft];\
[3:v] setpts=PTS-STARTPTS,scale=320x240 [lowerright]; \
[base][upperleft] overlay=shortest=1[tmp1];\
[tmp1][upperright] overlay=shortest=1:x=320 [tmp2]; \
[tmp2][lowerleft]overlay=shortest=1:y=240 [tmp3];\
[tmp3][lowerright] overlay=shortest=1:x=320:y=240" \
-f mp4 -y $(date +%Y%m%d)_output-re_$(date +%H%M%S).mp4
input1.mp4 input2.mp4 input3.mp4 input4.mp4
20251103_output-re_172154.mp4