FFMPEG: How to merge a video file (with its own audio) and an audio track (that should loop to fit the vido length)
Use -stream_loop
and amix filter:
ffmpeg -i video.mp4 -stream_loop -1 -i background.mp3 -filter_complex "amix=inputs=2:duration=shortest" -c:v copy -movflags +faststart output.mp4