With ffmpeg, I see how to add music file as background for a video, but the problem is how to make the audio loop/repeat. Is there a way out?
解决方案
ffmpeg has the promising -loop_input flag, but it doesn't support audio inputs yet.
I'd recommend sox and the -shortest option for ffmpeg as a solution.
sox -i short_audio.mp3 looped_audio.mp3 repeat 1000 # adjust count as necessary
ffmpeg -i input_video.mp4 -i looped_audio.mp3 -shortest output_video.mp4
The sox command will loop the input, and the ffmpeg command will use it for the audio, but stop when it runs out of video to process.