Log in

View Full Version : 4.1/5.1/7.1 Channel Configuration/Order


Richard1485
20th April 2014, 21:27
Is this order correct when merging six channels?

fl=WavSource("L.wav")
fr=WavSource("R.wav")
c=WavSource("C.wav")
lfe=WavSource("LFE.wav")
sl=WavSource("SL.wav")
sr=WavSource("SR.wav")

MergeChannels(fl,fr,c,lfe,sl,sr)

I also need to know how to use MergeChannels() for 7.1.

Moreover, when I decode Dolby TrueHD 7.1 to wavs, I don't which channel configuration to select in the DTS-HD MA encoding suite. There are two options:

1. 7.1 – L,R,C,LFE,Lss,Rss,Lsr,Rsr;
2. 7.1 – L,R,C,LFE,Ls,Rs,Lsr,Rsr.

1.
http://i57.tinypic.com/nd0ylk.png

2.
http://i62.tinypic.com/357pmd5.png

How does one know which to select?

AMED
21st April 2014, 03:32
Wouldn't it be easier to convert to FLAC and not WAV's?

Then use EAC3TO to do the downmix?

Overdrive80
21st April 2014, 03:34
For DTS 7.1 first option is correct. http://forum.doom9.org/showthread.php?p=1443085#post1443085

Richard1485
21st April 2014, 10:07
Thanks, Overdrive80. I'll just have to hope that if I come across 7.1 with the "strange setup" it will be apparent somehow.

@AMED
No, for various reasons in my workflow. Thanks for the suggestion though.

tebasuna51
21st April 2014, 10:11
MergeChannels(fl,fr,c,lfe,sl,sr)
Correct.
I also need to know how to use MergeChannels() for 7.1.
MergeChannels(fl,fr,c,lfe,bl,br,sl,sr)
bl,br means BackLeft, BackRight

Moreover, when I decode Dolby TrueHD 7.1 to wavs, I don't which channel configuration to select in the DTS-HD MA encoding suite.

Thats one: 7.1 – L,R,C,LFE,Lss,Rss,Lsr,Rsr;

BTW I don't know for what you recode TrueHD (free decoder) to DTS-MA (commercial decoder), with big size for the same quality.

Richard1485
21st April 2014, 10:26
Thanks, tebasuna.

BTW I don't know for what you recode TrueHD (free decoder) to DTS-MA (commercial decoder), with big size for the same quality.

I have two reasons. First, the free version of EasyBD Lite, which is my muxer of choice, does not like TrueHD. Secondly, I sometimes need to edit the audio track and recompress it without quality loss.

As always, thanks for your help. :)

SeeMoreDigital
21st April 2014, 10:37
First, the free version of EasyBD Lite, which is my muxer of choice, does not like TrueHD. Really...

Is this because your TrueHD stream does not contain an Dolby Digital core?

Richard1485
21st April 2014, 10:43
Really...

Yes.

Is this because your TrueHD stream does not contain an Dolby Digital core?

No.

Richard1485
6th June 2017, 01:49
How does one merge five channels and end up with a 3/1.1 channel configuration?

MergeChannels( fl, fr, cc, lfe, bc) seems to results in 5.0, because eac3to splits the result like this...

Writing WAVs...
Creating file "SR.wav"...
Creating file "R.wav"...
Creating file "C.wav"...
Creating file "L.wav"...
Creating file "SL.wav"...

...rather than like this...

Writing WAVs...
Creating file "C.wav"...
Creating file "LFE.wav"...
Creating file "BC.wav"...
Creating file "R.wav"...
Creating file "L.wav"...

Midzuki
6th June 2017, 08:14
How does one merge five channels and end up with a 3/1.1 channel configuration?

MergeChannels( fl, fr, cc, lfe, bc) seems to results in 5.0, because eac3to splits the result like this...

Writing WAVs...
Creating file "SR.wav"...
Creating file "R.wav"...
Creating file "C.wav"...
Creating file "L.wav"...
Creating file "SL.wav"...

...rather than like this...

Writing WAVs...
Creating file "C.wav"...
Creating file "LFE.wav"...
Creating file "BC.wav"...
Creating file "R.wav"...
Creating file "L.wav"...

You must use the decimal value 271 for the channel mask.

Speaker Position Decimal Value
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯

FRONT_LEFT 1
FRONT_RIGHT 2
FRONT_CENTER 4
LOW_FREQUENCY 8
BACK_LEFT 16
BACK_RIGHT 32
FRONT_LEFT_OF_CENTER 64
FRONT_RIGHT_OF_CENTER 128
BACK_CENTER 256
SIDE_LEFT 512
SIDE_RIGHT 1024
TOP_CENTER 2048
TOP_FRONT_LEFT 4096
TOP_FRONT_CENTER 8192
TOP_FRONT_RIGHT 16384
TOP_BACK_LEFT 32768
TOP_BACK_CENTER 65536
TOP_BACK_RIGHT 131072
RESERVED 262144

tebasuna51
6th June 2017, 10:10
# open your 5.1
a = ConvertAudioToFloat()
flr = Getchannel(a, 1, 2, 3, 4)
sl = Getchannel(a, 5)
sr = Getchannel(a, 6)
sur = MixAudio(sr, br, 1.0, 1.0).SoftClipperFromAudX(0.0)
mergechannels(flr,sur)
#convert to desired bitdepth

and put channel mask to 271, like Midzuki say, with BeHappy.

Richard1485
6th June 2017, 13:14
You must use the decimal value 271 for the channel mask.

Ah, so the channel mask is obtained by adding the decimal values of all the speakers together. Thanks! Previously, I have used MergeChannels() only with 2.0, 5.1, and 7.1 and have never had to set a channel mask.

@tebasuna51
Thank you very much! Does the conversion to float affect only the channels that are to be mixed? I am using mono wavs. Is the following correct?


fl=WavSource("l.wav")
fr=WavSource("r.wav")
c=WavSource("c.wav")
lfe=WavSource("lfe.wav")
sl=WavSource("sl.wav").ConvertAudioToFloat()
sr=WavSource("sr.wav").ConvertAudioToFloat()
sur=MixAudio(sl, sr, 1.0, 1.0).SoftClipperFromAudX(0.0).ConvertAudioTo24bit()

MergeChannels(fl,fr,c,lfe,sur)


EDIT: I'm running up against the file-size limit for WAV; my output is truncated. Is it possible to export W64/RF64 from BeHappy? I've exported as WV WavPack High Quality, and the file is no longer truncated, but eac3to doesn't accept it as input (and the channel configuration is still wrong, despite the fact that I set it in BeHappy).

https://s4.postimg.org/43u9utg0t/chnnlmsk271.png

EDIT (again): The channel configuration is right only when I export as WAV from BeHappy. When I export as FLAC or WV WavPack, it's wrong. Does Writing RIFF_EXT header to encoder's StdIn not mean that the channel configuration is being passed to the encoder?

tebasuna51
6th June 2017, 22:52
Does the conversion to float affect only the channels that are to be mixed? I am using mono wavs. Is the following correct?

Is perfect, if input wavs are 24 bits

I'm running up against the file-size limit for WAV; my output is truncated.

Behappy wav output can be greater than 4GB, and many soft (encoders) can manage that with the help of some parameters.
--ignore-chunk-sizes for instance for flac.

Is it possible to export W64/RF64 from BeHappy?

Yep, check Head (below ChMask) an put 1 (with mouse in word Head you can se: 0 = WAV, 1 = W64, 2 = RF64)

When I export as FLAC or WV WavPack, it's wrong. Does Writing RIFF_EXT header to encoder's StdIn not mean that the channel configuration is being passed to the encoder?

To WavPack the header with correct Channel Mask is sended, then seems a encoder problem.

To flac the wav header is not sended, only raw PCM data without Channel Mask info.

You can replace e_Flac.ext in Behappy\extensions by the attached one to send before the RIFF_EXT header. But you obtain a System.IO.IOException with a message like this:

ERROR: WAVEFORMATEXTENSIBLE chunk with unsupported channel mask=0x010F

The same if you try send the FL-FR-FC-LF-BC.wav to flac encoder:

flac FL-FR-FC-LF-BC.wav

Only accept channel mask than match: https://xiph.org/flac/format.html

Channel assignment

0000-0111 : (number of independent channels)-1. Where defined, the channel order follows SMPTE/ITU-R recommendations. The assignments are as follows:
1 channel: mono
2 channels: left, right
3 channels: left, right, center
4 channels: front left, front right, back left, back right
5 channels: front left, front right, front center, back/surround left, back/surround right
6 channels: front left, front right, front center, LFE, back/surround left, back/surround right
7 channels: front left, front right, front center, LFE, back center, side left, side right
8 channels: front left, front right, front center, LFE, back left, back right, side left, side right
1000 : left/side stereo: channel 0 is the left channel, channel 1 is the side(difference) channel
1001 : right/side stereo: channel 0 is the side(difference) channel, channel 1 is the right channel
1010 : mid/side stereo: channel 0 is the mid(average) channel, channel 1 is the side(difference) channel
1011-1111 : reserved

All other channel mask is rejected.
https://sourceforge.net/p/flac/feature-requests/96/

eac3to, accesing to libFLAC.dll, seems know how override the error and put the correct channel mask, but I don't know how make that with the command line encoder flac.exe.

Then output the wav or w64 or RF64 file, and encode to flac with eac3to.

Richard1485
6th June 2017, 23:26
Is perfect, if input wavs are 24 bits

They are! :-)

Yep, check Head (below ChMask) an put 1 (with mouse in word Head you can se: 0 = WAV, 1 = W64, 2 = RF64)

Great! I've got my W64 file (with the correct length). ¡Muchísimas gracias! :D:D:D


eac3to, accesing to libFLAC.dll, seems know how override the error and put the correct channel mask, but I don't know how make that with the command line encoder flac.exe.

Then output the wav or w64 or RF64 file, and encode to flac with eac3to.

Ah, I wondered if FLAC might not support the channel mask. Thanks! I'll use eac3to.

EDIT: I've just figured out that SoundOut() doesn't get the channel mask right either.

By the way, would you use SoftClipperFromAudX(0.0) when converting 5.1 to mono? So far, I've been using RaWavSource(,1).ConvertToMono().Normalize(), but perhaps there is a better way.

tebasuna51
7th June 2017, 12:52
EDIT: I've just figured out that SoundOut() doesn't get the channel mask right either.

Inside AviSynth we can't know the channel mask of a audio stream.
This is a old feature request to AviSynth (https://forum.doom9.org/showthread.php?p=1140652) than was rejected because is dificult to do.

There are two "patch" to manage the problem:

1) After v2.58 we can set:

Global OPT_UseWaveExtensible=True

That must be the default, and not a option, in 21 Century.
Not needed in BeHappy or MeGUI because the special AvisynthWrapper.dll

2) After v2.60 we can set:

Global OPT_dwChannelMask={int}

But who know the ChannelMask is the decoder and a old plugin like SoundOut() don't output WaveExtensible header.

By the way, would you use SoftClipperFromAudX(0.0) when converting 5.1 to mono? So far, I've been using RaWavSource(,1).ConvertToMono().Normalize(), but perhaps there is a better way.

The problem of Normalize() is when there are a big peak in all channels.
Forgeting LFE channel, than can't be used to downmix, we can have a peak at 500% and force reduce the overall volume to 1/5.

Now a normal (50%) dialog in FC is reduced to 10%.
Maybe we can do something than:

fl=WavSource("l.wav").ConvertAudioToFloat()
fr=WavSource("r.wav").ConvertAudioToFloat()
c=WavSource("c.wav").ConvertAudioToFloat()
sl=WavSource("sl.wav").ConvertAudioToFloat()
sr=WavSource("sr.wav").ConvertAudioToFloat()
left=MixAudio(fl,sl, 1.0, 1.0).SoftClipperFromAudX(0.0)
right=MixAudio(fr,sr, 1.0, 1.0).SoftClipperFromAudX(0.0)
c = MixAudio(left,c, 0.8, 1.0)
MixAudio(c, right, 1.0, 0.8).Normalize()
ConvertAudioTo24bit()

Or other balance instead 0.8, 1.0, 0.8

EDIT: Before I used a wrong MixAudio(left,c, right, 1.0, 0.8, 1.0).Normalize()
wrong because MixAudio only support 2 clips. Sorry.

Richard1485
8th June 2017, 00:43
Tebasuna, many thanks for providing me with a more refined way to downmix to mono! I'll give it a try as soon as possible. :)

Or other balance instead 0.8, 1.0, 0.8

I'm sorry, but I don't understand. Is this balance meant to differ from the script above? :-)

I appreciate your information about channel masks in AviSynth/SoundOut. It seems safer/easier to set them in BeHappy.

tebasuna51
8th June 2017, 10:05
The problem of the downmix is let the dialog volume (FC most the times) too low to listen.

If we mix the 5 channel together and after Normalize() we can obtain a dialog volume at 20% than original.

For that I propose mix the left and right channels before with a limited volume (SoftClipperFromAudX) and after mix only 3 channel.
That can let the FC channel at 33% than original.

Even if you want priorize the FC you can do the last mix un-balanced (left,c,right, 0.8, 1.0, 0.8), FC at 38%.
But is dificult to know the proper value than can change with each audio.
You can try between balanced (left,c,right, 1.0, 1.0, 1.0), than let FC at 33%, until more un-balanced (left,c,right, 0.5, 1.0, 0.5) than let FC at 50%.

Richard1485
8th June 2017, 21:00
Got it! I appreciate the detailed explanation, tebasuna51. :)

Richard1485
9th June 2017, 16:56
^^ Unfortunately, I receiver an error when using the script.


Script error: Invalid arguments to function "MixAudio"


The reference is to the line:


MixAudio(left,c,right, 0.8, 1.0, 0.8).Normalize()


I don't see the error. Obviously, the fact that the audio is float means that the volume factor can exceed 1.0, and I presume from other people's scripts that MixAudio() can take more than two clips, but the script won't load unless I remove one of them. I'm confused.

hello_hello
9th June 2017, 20:43
Isn't MixAudio() limited to two inputs?

You could make a function out of it like the script below. 5.1ch downmix, LFE not included by default and normalising is enabled, so it might be slow to open. Then all you'd need is Downmix() in a script with ConvertAudioTo16bit(), or whatever output you want, or something like the following to adjust settings if need be:

Downmix(CentreGain=1.1, SurroundGain=0.7, Normalise=False).ConvertAudioTo16bit()


# Defaults: FrontGain=1.0, CentreGain=0.8, LFEGain=0.0, SurroundGain=1.0, EnableSoftClip=True, SoftClipFactor=0.0, Normalise=True

function Downmix(clip a, float "FrontGain", float "CentreGain", float "LFEGain", float "SurroundGain", bool "EnableSoftClip", float "SoftClipFactor", bool "Normalise")
{
a.ConvertAudioToFloat()

FL = GetChannel(a, 1)
FR = GetChannel(a, 2)
FC = GetChannel(a, 3)
LFE = GetChannel(a, 4)
SL = GetChannel(a, 5)
SR = GetChannel(a, 6)

assert(a.AudioChannels == 6, """The audio must have 6 channels""")

FrontGain = default(FrontGain, 1.0)
CentreGain = default(CentreGain, 0.8)
LFEGain = default(LFEGain, 0.0)
SurroundGain = default(SurroundGain, 1.0)
EnableSoftClip = default(EnableSoftClip, True)
SoftClipFactor = default(SoftClipFactor, 0.0)
Normalise = default(Normalise, True)

# Mix Front Left/Right & Surround Left/Right
FL_SL = MixAudio(FL, SL, FrontGain, SurroundGain)
FR_SR = MixAudio(FR, SR, FrontGain, SurroundGain)

# Add LFE & Apply Limiting
FSL_LFE = MixAudio(FL_SL, LFE, 1.0, LFEGain)
FSR_LFE = MixAudio(FR_SR, LFE, 1.0, LFEGain)
FSL_LFE_Soft = MixAudio(FL_SL, LFE, 1.0, LFEGain).SoftClipperFromAudX(SoftClipFactor)
FSR_LFE_Soft = MixAudio(FR_SR, LFE, 1.0, LFEGain).SoftClipperFromAudX(SoftClipFactor)

Mix_Left = (EnableSoftClip == False) ? FSL_LFE : FSL_LFE_Soft
Mix_Right = (EnableSoftClip == False) ? FSR_LFE : FSR_LFE_Soft

# Add Centre
Left = MixAudio(Mix_Left, FC, 1.0, CentreGain)
Right = MixAudio(Mix_Right, FC, 1.0, CentreGain)

AudioOut = (Normalise == false) ? MergeChannels(Left, Right) : MergeChannels(Left, Right).Normalize(0.95)

Return AudioOut
}

Mind you I prefer using a GUI. Mostly foobar2000. There's a Matrix Mixer DSP you can add to the conversion chain and you can save conversion setups as presets, and there's a plugin that lets it open Avisynth scripts, so you could load a script like the one above and convert it that way. Messing around with individual mono wave files or intermediate files seems too hard when you can just open a file, right click and convert, and let the GUI take care of the channel mask stuff.
You can use ffmpeg as an audio encoder with foobar2000, and ffmpeg will accept any channel mask when converting to flac, although the official flac encoder will do the same if you add --channel-map=none to the command line. The channel mask info is saved to a WAVEFORMATEXTENSIBLE tag, so I guess it'd be up to the player to decide if it will read it and output the correct channels for non standard layouts, but I assume it works the same way when encoding with libFLAC etc.

tebasuna51
9th June 2017, 21:08
My fault. Yes MixAudio is limited to 2 clips.

Then we need two pass:

c = MixAudio(left,c, 0.8, 1.0)
MixAudio(c, right, 1.0, 0.8).Normalize()

Richard1485
11th June 2017, 14:40
That works. Thanks! The downmix sounds nice. :)

Mind you I prefer using a GUI...
...Messing around with individual mono wave files or intermediate files seems too hard when you can just open a file, right click and convert, and let the GUI take care of the channel mask stuff.

I dislike GUIs and am happier writing a script (or quickly adapting an existing one, as is usually the case). Most of the time, I decode my audio with eac3to and can pick my output format, so only rarely do I have cause to create individual WAVs. I appreciate your writing a downmix function though. I'm sure it will come in handy at some stage. :-)

Nikos
2nd August 2018, 21:06
After reading carefully the previous posts, i decided to make my own script to convert from 5.1 channels to plain stereo (without LFE) and i want your opinion.

fl = WavSource("L.wav").ConvertAudioToFloat()
fr = WavSource("R.wav").ConvertAudioToFloat()
c = WavSource("C.wav").ConvertAudioToFloat()
sl = WavSource("SL.wav").ConvertAudioToFloat()
sr = WavSource("SR.wav").ConvertAudioToFloat()

# For sg, i consider the values between 0.707 and 1.0 reasonable.
left = MixAudio(fl, sl, 1.0, sg).SoftClipperFromAudX(0.0) # reduce volume only if clip is detected
right = MixAudio(fr, sr, 1.0, sg).SoftClipperFromAudX(0.0) # reduce volume only if clip is detected

# For cg, i think the maximum value should be 0.707, because the acustic power is the square of the amplitude.
--> Edit: the minimum value should be 0.707. <--
(0.707 x 0.707) + (0.707 x 0.707) = 0.5 + 0.5 = 1.
leftc = MixAudio(left, c, 1.0, cg)
rightc = MixAudio(right, c, 1.0, cg)

# Stereo (Maybe we need attenuate or amplify)
mix = MergeChannels(leftc, rightc)

# Check for overflows and RMS values, with SoundOut plugin
# SoundOut(mix)

# Final stage
Normalize(mix) # 0dB
# or
# Normalize(mix, 0.89125) # -1dB
# or
# AmplifydB(mix, ...)

:thanks:

FranceBB
2nd August 2018, 23:48
@Nikos... There are many ways to make a stereo downmix out of a 5.1 surround, many people generally use Dolby Pro Logic II, like so:


function Dmix5Dpl2(clip a) # 5 Channels L,R,C,SL,SR -> dpl II
{
flr = GetChannel(a, 1, 2)
fcc = GetChannel(a, 3, 3)
lrc = MixAudio(flr, fcc, 0.3254, 0.2301)
bl = GetChannel(a, 4)
br = GetChannel(a, 5)
sl = MixAudio(bl, br, 0.2818, 0.1627)
sr = MixAudio(bl, br, -0.1627, -0.2818)
blr = MergeChannels(sl, sr)
return MixAudio(lrc, blr, 1.0, 1.0)
}

tebasuna51
2nd August 2018, 23:53
The standard Downmix uses sg = 1 and cg = 0.707.
In my opinion sg can be lower, but cg can't be lower to preserve dialog volume.

The big difference in your method is include the SoftClipperFromAudX() in the first mix.
I'm not sure about that, I use SoftClipperFromAudX() in 7.1 -> 5.1 mixing back and side channels not so important than front channels.

But if work for you...

Nikos
3rd August 2018, 02:07
Thank you guys for the answers.
I understand that sg can be lower, I think that sg = 0.707 is reasonable and we are in line with the ITU-R BS.775-3 recommendation.

I encode old movies with 5.1 audio and the surround channels are mostly empty.
The SoftClipperFromAudX(), it's not critical and work for me :)
I'm more interested in the center channel.

In a test, Ι did in "The Good, the Bad and the Ugly" with the above script (sg=1.0 and cg=0.707), Ι had to add AmplifydB(mix,-3.61) to avoid overflows, while with sg=0.707 and cg=0.707, Ι had to add AmplifydB(mix,-3.23).

I need a clarification about cg:
With cg=0.707 we have all the acoustic power of the center channel.
Why we have to increase the cg beyond 0.707? (Unless it is a badly made film)
Which value range is acceptable?

tebasuna51
3rd August 2018, 08:47
I encode old movies with 5.1 audio and the surround channels are mostly empty.
The SoftClipperFromAudX(), it's not critical and work for me :)

When original source is stereo (or even mono in very old movies) the 5.1 provided was created with artificial (or empty) surround channels derived from front channels.
To downconvert to stereo is safe (we don't lose audio info) ignore the surround channels and use only the front channels (your second mix).

Why we have to increase the cg beyond 0.707? (Unless it is a badly made film)
Which value range is acceptable?

Like you say the 0.707 value is the recommended unless you experiment low dialog volume.

Nikos
3rd August 2018, 13:11
@tebasuna51 thank you for the clarifications.
You are right in everything :)
The cg value can't be lower than 0.707 to preserve dialog volume.

Another question:
Is there any reason to add to the script:
Global OPT_UseWaveExtensible = true
and or
Global OPT_dwChannelMask = ("0x00003") # for stereo

tebasuna51
3rd August 2018, 21:03
I don't know any encoder, or soft than accept avs input, than need WaveFormatExtensible headers for stereo wav's.

Nikos
4th August 2018, 13:02
After readind this page (https://en.wikipedia.org/wiki/Decibel) about decibel, Ι have a technical question:
Does the AmplifydB(sound, -3) line in Avisynth script, reduce the amplitude or acoustic power of the sound in half?

tebasuna51
4th August 2018, 18:15
Yes, in amplitude 0.707 and in acustic power 0.5 (half).
Like you say before: ..." 0.707, because the acustic power is the square of the amplitude."

Nikos
4th August 2018, 19:43
Thank you very much for the answers you give me.
But... new day, new idea...
For old movies where the back channels are mostly empty, I can just encode the three front audio channels and during playback I can adjust the level of the dialogs with lav filter or ffdshow.

For example:
global OPT_dwChannelMask = ("0x00007")
audio = WavSource("5.1.wav")
GetChannels(audio, 1, 2, 3)

What is your opinion?

I did a test and in the resulting .wav file, the MediaInfo reports 3 channels but not Channel positions Front: L C R.

But in the resulting .m4a file from BeHappy, the MediaInfo reports 3 channels and Channel positions Front: L C R.

Edit:
With the help of the ChMask=7 in BeHappy, the 3 channels .wav have Channel positions Front: L C R.

tebasuna51
5th August 2018, 20:38
What is your opinion?
It's ok if you want preserve 3 channels, but some audio systems can have problems with multichannel.

I did a test and in the resulting .wav file, the MediaInfo reports 3 channels but not Channel positions Front: L C R.

What soft you use to write a wav with this .avs?

BeHappy have a special AvisynthWrapper.dll to write the wav header WAVE_FORMAT_EXTENSIBLE with the selected chMask.

Nikos
5th August 2018, 22:26
I used the BeHappy.

Without ChMask=7, the resulting .wav file, reports 3 channels but not Channel positions Front: L C R.

With ChMask=7, the resulting .wav file, reports 3 channels and Channel positions Front: L C R.

Is there a manual way, to write the wav header WAVE_FORMAT_EXTENSIBLE, with the help of AvisynthWrapper.dll?
I can not find information about using it within an .avs script.
Ιt's part of ΒeΗappy source code?

I know that I can add the header, with the help of wavfix (https://forum.doom9.org/showthread.php?t=167666).

Today I did a test:
1. I converted a 5.1 DTS Master Audio sound, from an old movie to
3.0 (Front) .wav, 5.0 (Front+Back) .wav and 5.1 (Front+Back+LFE) .wav.

2. I coded the above three .wav files, with Nero AAC (-lc -q 0.60).

3. The results:
3.0 .acc --> 360 kb/s # normal
5.0 .aac --> 552 kp/s # normal
5.1 .aac --> 553 kp/s # ?

It seems strange to me the last result, I was expecting more than 553 kp/s.

I coded the LFE channel alone and the the resulting .aac have 10 kb/s!!!

Thank you for your support for so many years :)

tebasuna51
6th August 2018, 10:16
The ChMask is the most important field than add the WAVE_FORMAT_EXTENSIBLE header.
In BeHappy the header WAVE_FORMAT_EXTENSIBLE is used when the ChMask (in Tweak section) is activated.
And yes is part of BeHappy code.
If ChMask is let to 0 value a default is used for number of channels (like wavfix):

Chan. Mask hex-dec MS channels ordered Description
----- ------------ ----------------------- -----------------------
1 0x0004 4 FC Mono 1/0.0
2 0x0003 3 FL FR Stereo 2/0.0
3 0x0007 7 FL FR FC Stereo + Center 3/0.0
4 0x0033 51 FL FR BL BR Quadro 2/2.0
5 0x0037 55 FL FR FC BL BR Dpl II 3/2.0
6 0x003F 63 FL FR FC LF BL BR Standard 5.1 3/2.1
7 0x013F 319 FL FR FC LF BL BR BC With Back Cent. 3/3.1
8 0x063F 1599 FL FR FC LF BL BR SL SR Standard 7.1 3/2/2.1

The channel order in a wav file for 3.0 is FL FR FC (not L C R)

The LFE (Low Frequency Effects) have only very low frequencies (filtered by DTS Master Audio) and most the time is empty in old movie sound tracks.
A VBR (Variable BitRate) encode (like Nero -q 0.60) need only a very low bitrate to add that channel.
Big bitrate is only needed for high frequencies.

Nikos
7th August 2018, 00:40
I understood well about the header and ChMask field in BeHappy.
I think there should be a reference about the ChMask in the help files.

Thanks again.

tebasuna51
18th August 2018, 13:10
The ChMask is a problem for Avisynth, like I say to IanB (Avisynth 2.6 developer) long time ago, and to Avs+ developers recently, the ChMask must be a audio property replacing NumChannels (NumChannels can be obtained from ChMask only adding the bits).

The Global variables:

global OPT_UseWaveExtensible = true
global OPT_dwChannelMask = $7

are ignored or rejected (Wavi), and I don't know any soft than use them.

The ChMask by default for 3 channels audio is 3.0 ($7 or FL FR FC) for Wavi, avs2pipemod or BeHappy, but for ffmpeg is 2.1 ($11 or FL FR LFE), you can't create a AC3 3.0 directly with the .avs and ffmpeg:
Guessed Channel Layout for Input Stream #0.0 : 2.1

All work for standard 2.0 or 5.1 because are defaults for all soft.
But if you have a not standard ChMask the Global variables are useless, and you need BeHappy or Wavi to specify the correct ChMask manually.