Add Shorter audio to video with loop with volume control of both audio and video and with only for a specific duration ((i want to add audio and keep both audio and the videos sound in both cases))
I have two part of a problem
1) audio is 27 seconds long 2) Video is 2 mins 24 seconds long
a) I want to loop the audio and add it to the video for example (add audio only) from 50 seconds to 1 min 30 seconds (not the whole video but still get the whole video as output )within the video , with the looped audio
b) create a clip of video from 50 seconds to 1 min 30 seconds (not whole video as output)within the video , with the looped audio
I have used follwing command from ffmpeg to add audio to video , which adds it the whole video, how can we i) specify only a part of video to have the looped audio ii) create a new clip for the selected duration with the looped audio
so far I Have been able to loop, and change volume of both audio and video and mix them with following command for whole video
"-y","-i",videofile, "-filter_complex",
"amovie=audiofile:loop=1000,asetpts=N/SR/TB,aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=1.5[a1];" +
"[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2];" +
" [a1][a2]amerge,pan=stereo:c0<c0+c2:c1<c1+c3[out]",
"-map","0:v","-map","[out]","-c:v","copy","-c:a","aac","-shortest","-preset", "ultrafast", outputfile
I am stuck in managing time in both the cases