user2216280
user2216280

Reputation: 73

create mono and stereo stream in the same file with ffmpeg?

I have a film with 2 mono audio stream of avi file.

I would like to create a third file, with one stereo stream from the 2 mono stream, and one mono stream, addition of the 2 monos audio source... here's the code to make mono stream:

ffmpeg -i input.avi-ac 1 mono.avi

here's the code to make an stereo stream from 2 mono stream:

ffmpeg -i input.avi-filter_complex "[0:1][0:2] amerge=inputs=2" -c:a pcm_s16le output.avi

How could I merge those 2codes to make one audio file with one stero track, and one mono track ? tiouss ! thanks in advance

Upvotes: 0

Views: 1813

Answers (2)

user2216280
user2216280

Reputation: 73

really cool !! This does work: (apparently ffmpeg doesn't like when you use the same label twice):

ffmpeg -i input.avi -filter_ complex "[0:1][0:2]amerge=inputs=2[stereo]"
  -map "[stereo]" -filter_complex "[0: 1][0:2]amerge=inputs=2[formono]"
 -map "[formono]" -ac:a:1 1 -c:a pcm_s16le -map 0:v -c:v copy out.avi 

Thank you so much Mulvya for your precious help!!!!

Upvotes: 0

Gyan
Gyan

Reputation: 92928

Use

ffmpeg -i input.avi
  -filter_complex "[0:1][0:2]amerge=inputs=2[stereo]"
  -map "[stereo]" -map "[stereo]" -ac:a:1 1 -c:a pcm_s16le output.avi

Video, is any, is ignored. Add -map 0:v -c:v copy if video has to be preserved.

Upvotes: 1

Related Questions