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

后端 未结 6 1722
梦毁少年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:16

    You can not do that using one cmd.


    1. Get the audio from video file, the audio file name is a.mp3

    ffmpeg.exe -i video.mp4 a.mp3
    

    2. Merge two audio files(audio.mp3+a.mp3=audiofinal.mp3)

    ffmpeg.exe -i audio.mp3 -i a.mp3 -filter_complex amerge -c:a libmp3lame -q:a 4 audiofinal.mp3
    

    3. Merge video file and audio file(video.mp4+audiofinal.mp3=output.mp4)

    ffmpeg.exe -i video.mp4 -i audiofinal.mp3 -map 0:v -map 1:a -c copy -y output.mp4
    

提交回复
热议问题