[FFmpeg-user] Extract sound from multiple input files

Moritz Barsnick barsnick at gmx.net
Mon Apr 29 13:17:41 EEST 2024


On Mon, Apr 29, 2024 at 11:48:18 +0200, Michael Koch wrote:
> Am 29.04.2024 um 11:28 schrieb turgut kalfaoğlu:
> > Hi. I have an interesting case. I need to extract sound from multiple
> > input files,  combine those video files into one, and then re-insert the
> > audio into the combined video file.
> >
> > $ ffmpeg -i resized/360_0233.MP4   -i resized/360_0234.MP4   -i
> > resized/360_0235.MP4 -vn -map 0:a   tmpsound.mp3

You explictly selected only the fist input with "-map 0:a".

> Not tested, but I think it should work with the concat filter:
>
> ffmpeg -i resized/360_0233.MP4 -i resized/360_0234.MP4 -i
> resized/360_0235.MP4 -lavfi [0][1][2]concat=n=3:v=0:a=1 -y tmpsound.mp3

I have a different interpretation of what "combine those into one" was
supposed to mean. ;-)

Turgut, can you be more precise? The three audio tracks, what shall
happen with them?

* Attach audio one after the other on the timeline (i.e. concatenate).
* Insert all three audio tracks as separate parallel tracks into the
  resulting video.
* Overlay all three audio tracks, so that you hear their sound
  simultaneously in the final track.

Michael's solution is for problem no. 1.

Cheers,
Moritz


More information about the ffmpeg-user mailing list