Singler line FFMPEG cmd to Merge Video /Audio and retain both audios

后端 未结 6 1814
梦毁少年i
梦毁少年i 2021-01-30 09:25

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

6条回答
  •  不要未来只要你来
    2021-01-30 10:07

    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

提交回复
热议问题