FFmpeg: Combine video files with different start times
This command below presents the case for 3 inputs. First input is the longest and remains on the left. The 2nd input starts at t=1 second and lasts for 3 seconds, the 3rd lasts for 2 seconds starting at t=4s. They show on the right.
ffmpeg -i 1.mp4 -i 2.mp4 -i 3.mp4 -filter_complex \
"[0]pad=2*iw:ih[l];[1]setpts=PTS-STARTPTS+1/TB[1v]; [l][1v]overlay=x=W/2[a]; \
[2]setpts=PTS-STARTPTS+4/TB[2v]; [a][2v]overlay=x=W/2[v]; \
[1]adelay=1000|1000[1a]; [2]adelay=4000|4000[2a]; [0][1a][2a]amix=inputs=3[a]" \
-map "[v]" -map "[a]" out.mp4
The adelay
filters are for stereo input streams.