Reputation: 41
I wanna add a background music on my video. I tried this command
ffmpeg -i video.mkv -i audio.m4a -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map 0:v -map "[a]" -c:v copy -ac 2 output.mkv
It worked but when music ended, My Video Sound end too. I want to repeate the background music until video end. And if I can change background music volume it will be awosome
Upvotes: 0
Views: 1262
Reputation: 41
I found the solution and wanna share it with you guys
ffmpeg -i video.mp4 -stream_loop -1 -i audio.mp3 -c:v copy -filter_complex "[0:a]aformat=fltp:44100:stereo,apad[0a];[1]aformat=fltp:44100:stereo,volume=0.08[1a];[0a][1a]amerge[a]" -map 0:v -map "[a]" -ac 2 -shortest output.mp4
It make the audio looped and play it until video end with audio volume 0.08 and you can change it here
Upvotes: 3