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:
It’s cool to see more people writing posts and experimenting on this topic. I was surprised at how little info I could find trying to research this about a year ago, and spent a decent chunk of this year experimenting with trying to create vintage/retro video filters using FFmpeg. If anyone is curious, I shared a bunch of my notes on this topic here a little while ago: https://zayne.io/articles/vintage-camera-filters-with-ffmpeg