Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I wanted to know if there is a way to split stereo into two mono wav files. My first guess was

ffmpeg -threads "16" -i "$2" -map 0:1:1 "$3"

because my example video has the following informations:

Audio
ID                                       : 2
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format profile                           : LC
Codec ID                                 : 40
Duration                                 : 39mn 0s
Bit rate mode                            : Constant
Bit rate                                 : 256 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R

So I have this one audio stream with two channels and want two mono channels. At first I tried it with map_channel, but that didn't do the trick instead I was getting an error message:

Syntax error, mapchan usage: [file.stream.channel|-1][:syncfile:syncstream]

So I have tried it again with the above mentioned code and at least ffmpeg did something, but the outcome was not what I expected, instead of breaking it down into two mono wav files, the outcome was:

info.system.container = WAVE
info.system.size = 449413166 Bytes
info.system.size = 428.59 MiB
info.system.playtime = 2340.69 s
info.audio0.codec = PCM
info.audio0.desc = 
info.audio0.format_endianness = Little
info.audio0.format_sign = Signed
info.audio0.format_resolution = 16 bits
info.audio0.samprate = 48000 Hz
info.audio0.channels = 2

again with two audio channels, so where did I go wrong?

share|improve this question

2 Answers 2

Using ffmpeg there are three methods that I know of to go from stereo to two mono files (or streams).

-map_channel option

ffmpeg -i stereo.wav -map_channel 0.0.0 left.wav -map_channel 0.0.1 right.wav

pan audio filter

ffmpeg -i stereo.wav -filter_complex \
"[0:0]pan=1:c0=c0[left]; \
 [0:0]pan=1:c0=c1[right]" \
-map "[left]" left.wav -map "[right]" right.wav

channelsplit audio filter

This will create one output file that has two individual mono streams:

ffmpeg -i input.m4a -filter_complex channelsplit out.mka

Also see

share|improve this answer
    
Thank you, I have found my flaw. When I was using -map_channelI didn't use single dots but instead I used double dots, so it's no wonder it didn't work. Now it works! –  sebastian Dec 10 '13 at 8:22
    
lets presume I have a file with 6 channels in one stream, how do I know which channel is which? When I have 2 channels its easy, its always 0.0.0 left and 0.0.1 right. I have looked up in the ffmpeg documentation and it says -layoutsbut there is no example how it works. I have tried it and the message I get is Missing argument for option 'layouts' what argument is ffmpeg expecting? –  sebastian Dec 10 '13 at 11:18
    
@sebastian You want to make six mono output files from the six channel input? –  LordNeckbeard Dec 10 '13 at 18:16
    
I have two or three clips which have 5.1 surround sound and of course after I use map_channel on all six of them I can't tell which map_channel belongs to which position, here is an example: Audio ID : 2 Channel(s) : 6 channels Channel positions : Front: L C R, Side: L R, LFE , but I think I already have found a solution for this problem. –  sebastian Dec 11 '13 at 9:52
    
@sebastian What is your solution? –  LordNeckbeard Dec 11 '13 at 18:58

You should use channelsplit filter for that. -map can not do this. For example:

ffmpeg -i in.mp3 -filter_complex channelsplit out.mkv

Check link to documentation that I've provided.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.