I like to get the duration of the base video using ffprobe, then use -stream_loop -1 to loop the overlay video on top of it, while using -t with the duration before the output to ensure it will only be as long as the duration of the base video. Here's an example: