I have a project that requires merging of a video file with another audio file. The expected out put is an video file that will have both the audio from actual video and the me
I don't think extracting the audio from the video is necessary. We can just use -filter_complex amix
to merge both audios:
ffmpeg -i videowithaudio.mp4 -i audiotooverlay.mp3 -filter_complex amix -map 0:v -map 0:a -map 1:a -shortest videowithbothaudios.mp4
-filter_complex amix
overlays the audio from the first input file on top of audio in the second input file.
-map 0:v
video stream of the first input file.
-map 0:a
audio stream of the first input file.
-map 1:a
audio stream of the second input file.
-shortest
the length of the output is the length of the shortest input