I am able to join video and audio files fine but if for example I add a 30 second audio clip to a minute long video, the audio will loop again once the 30 second mark is reached.
I want the audio to not loop so it should finish at the 30 second mark. I've looked around but couldn't find a solution. Any help will be greatly appreciated.
I believe you can achieve your desired aim by using the -filter_complex option and the apad filter option to pad out your audio with silence at the end if the video is longer. Your command would be:
ffmpeg -i videofile.mp4 -i audiofile.wav -filter_complex " [1:0] apad " -shortest output.mp4
This assumes the audio you want is in the first stream of audiofile.wav, the [A:B] syntax says to take the B'th stream from the A'th input (both starting with 0, so [1:0] is the 1st stream from the 2nd input, or audiofile.wav above).
Details at: https://www.ffmpeg.org/ffmpeg-filters.html#Examples-68
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.