[FFmpeg-user] How to create a multichannel wav file without a specific channel layout

Tobias Rapp t.rapp at noa-archive.com
Mon Sep 26 16:58:10 EEST 2016

On 26.09.2016 13:10, Robert Krüger wrote:
> Hi,
> On Mon, Sep 26, 2016 at 12:42 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com>
> wrote:
>> 2016-09-26 12:17 GMT+02:00 Robert Krüger <krueger at lesspain.software>:
>>> I would like to know if it is possible to create a wave file that
>> contains
>>> n channels of audio which do not have a channel layout like 5.1 or
>> stereo,
>> (I assumed n==1 here because it should work fine for n>2)
>>> much like a file used in broadcast for just storing n signals in one wav
>>> file.
>> It works fine for >16bit or >48kHz.
>> I just sent a patch that fixes it for all (pcm) audio, that will not fix
>> the
>> front center (mono) case though: If this is an issue (if your software
>> does not default to front center for 1-channel pcm wav), please
>> tell me;-)
> Thanks for the quick reply! I meant something like writing a 4,6 or
> 8-channel wav that just really contains 4,6,8 mono channels. E.g. some
> cameras or other multi-track recording devices generate signals like these
> and I would like to be able to put them in one wav file for archiving or
> later processing.

If the input file doesn't have a channel mask you should be able to use 
the "-guess_layout_max 0" input option.

> Reading a bit through a few specs I am not sure whether
> this requires using RF64 features (specifically the new constant
> SPEAKER_ALL 0x80000000 for the channel assignment) and, to be honest, if
> that makes sense at all.

In my opinion an undefined channel mask makes sense in your case. I'm in 
a very similar situation when recording AVI files with PCM audio and 
there I use the "-write_channel_mask off" output option.

You don't need RF64 features, see section "Details about dwChannelMask" 
in https://msdn.microsoft.com/en-us/library/windows/hardware/dn653308.aspx :

"If, for example in a multi-channel audio authoring application, no
speaker location is desired on any of the mono streams, the
dwChannelMask should explicitly be set to 0."

Best regards,

More information about the ffmpeg-user mailing list