Home:ALL Converter>How merge audio in video with outside audio using ffmpeg?

How merge audio in video with outside audio using ffmpeg?

Ask Time:2022-06-07T12:17:03         Author:Azornes

Json Formatter

I have 2 files:

  • video_orginal.ts,
  • sound_outside.wav

video_orginal have own sound track. I wants to turn down the volume of the sound from video_orginal and next merge sound_outside.wav with sound in video_orginal to finally get a video with mixed audio. Now I execute 4 working commands:

ffmpeg -i video_orginal.ts -map 0:a -c copy sound_from_video.wav -map 0:v -c copy video_clean.ts                            --exteract audio and video
ffmpeg -i sound_from_video.wav -filter:a "volume=0.3" sound_from_video_quiet.wav                                            --quiet sound
ffmpeg -i sound_from_video_quiet.wav -i sound_outside.wav -filter_complex amix=inputs=2:duration=longest sound_mixed.wav    --merge sounds
ffmpeg -i video_clean.ts -i sound_mixed.wav -c copy video_final.mkv                                                  --final merge video and sound

It is possible to execute only one command which will do all these steps with as little encoding as possible?

Author:Azornes,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/72525845/how-merge-audio-in-video-with-outside-audio-using-ffmpeg
yy