Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: from AC3 6ch to AC3 2ch just L + R? (Read 11266 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

from AC3 6ch to AC3 2ch just L + R?

Is there a way to lossless extract just the L + R channel from an AC3 6ch to a new AC3 2ch?

I know a lot of way to do so extracting to wav, but I do not want to later re-encode!

This is the reason:

I have a DVD Video with a live concert. The LFE is blank, C is quite unused and the RL + RR are just low volume noise.

I know this because I've listened it separating ch one by one during play with Foobar and channel splitter.

I would like to keep just the L + R channels, for archiving and for lintening in AC3 compatibile equipment.

My goal is to lossless extract just the L + R from the original 6ch AC3 and obtain a new 2ch AC3.

With Foobar would be very easy, if my source were 6ch lossless audio format. But I have the AC3, so I can not (I do not want to) re-encode ...

Thank you in advance.

Raf.

from AC3 6ch to AC3 2ch just L + R?

Reply #1
what you want is impossible as far as I understand ac3. You have to reencode. There might be channel coupling (like mid+side/left+right coding in mp3) across all channels, making them depend on each other.

hmm, that leads me to the question, that maybe if all channels are coded independently (I really doubt that as it would be a huge waste of bitrate given channels are always quite related to each other), it is indeed possible? But I don't know how one could do that...
flac 1.2.1 -8 (archive) | aoTuVb5.7 -q 4 (pc, s1mp3)

from AC3 6ch to AC3 2ch just L + R?

Reply #2
So you are talking about a sort of native "joint multichannel" of the AC3, like the option "joint stereo" for the mp3 encoding?

If so I really do not know how it can be so efficient separating channels like it did. You can, for example, listen a complete clear single channel test viewing the spectrum of all the other channels completley flat.

I tought that a 5.1 standard 448kbps was made of 4ch of 96kbps each + C at 64kbps + a very small amount for the optional LFE, all indipendent encoded ...

Like the famouse mp3 CBR 128kbps is made of 2ch of 64kbps each.

In any case thankyou for your reply, it was very interesting.

from AC3 6ch to AC3 2ch just L + R?

Reply #3
Assuming that the channels are not coupled, I am almost certain that the bitrate is not distributed evenly among them. The losslessly extracted channels would then be VBR, possibly incompatible with your decoder(s).

I wouldn't bother doing anything with that stream, unless it has some audible flaws.

from AC3 6ch to AC3 2ch just L + R?

Reply #4
I am almost certain that the bitrate is not distributed evenly among them.


If so how can you explain:

1. The default preset encode: 1ch at 96kbps,  2ch at 192kbps,  4ch at 384kbps,  5ch at 448kbps?
2. The dimension of the resulting files seems to completely confirm that?

If you send to the encoder 2ch it encodes at 192, 4ch at 384 and 5 or 5.1 at 448.

An ac3 192kbps si big the almost the same than a mp3 cbr 192kbps.

But in particular:

2ch encoded in 384 make a file big the same than a 4ch encoded at 384. So 384 is the overall kbps. Atherways where are stored the other 2ch??

Few people even know that an mp3 CBR 128 is L 64 kbps + R 64 kbps!

from AC3 6ch to AC3 2ch just L + R?

Reply #5
I tought that a 5.1 standard 448kbps was made of 4ch of 96kbps each + C at 64kbps + a very small amount for the optional LFE, all indipendent encoded ...

Like the famouse mp3 CBR 128kbps is made of 2ch of 64kbps each.

http://www.atsc.org/standards/a_52b.pdf

Quote
The actual AC-3 encoder is more complex than indicated in Figure 1.2. The following
functions not shown above are also included:
1. A frame header is attached which contains information (bit-rate, sample rate, number of
  encoded channels, etc.) required to synchronize to and decode the encoded bit stream.
2. Error detection codes are inserted in order to allow the decoder to verify that a received frame
  of data is error free.
3. The analysis filterbank spectral resolution may be dynamically altered so as to better match
  the time/frequency characteristic of each audio block.
4. The spectral envelope may be encoded with variable time/frequency resolution.
5. A more complex bit allocation may be performed, and parameters of the core bit allocation
  routine modified so as to produce a more optimum bit allocation.
6. The channels may be coupled together at high frequencies in order to achieve higher coding
  gain for operation at lower bit-rates.
7. In the two-channel mode, a rematrixing process may be selectively performed in order to
  provide additional coding gain, and to allow improved results to be obtained in the event that
  the two-channel signal is decoded with a matrix surround decoder.
.

I guess this applies to MP3 as well.

from AC3 6ch to AC3 2ch just L + R?

Reply #6
Very, very interesting!!

Thank you Mr. Martel

After reading that ... for sure there's no way to lossless extract 2ch from a 6ch AC3 flow. 

I didn't expected the multichannel AC3 was so advanced ...

Aften is so fast to encode ... that I really didn't expected so!

Interesting ...

from AC3 6ch to AC3 2ch just L + R?

Reply #7
Few people even know that an mp3 CBR 128 is L 64 kbps + R 64 kbps!


That's not true. From LAME helpfile:

Quote
* -m s/j/f/d/m    stereo mode
Joint-stereo is the default mode for input files featuring two channels..

stereo
In this mode, the encoder makes no use of potentially existing correlations between the two input channels. It can, however, negotiate the bit demand between both channel, i.e. give one channel more bits if the other contains silence or needs less bits because of a lower complexity.


joint stereo
In this mode, the encoder will make use of correlation between both channels. The signal will be matrixed into a sum ("mid"), computed by L+R, and difference ("side") signal, computed by L-R, and more bits are allocated to the mid channel.

...
...

dual channels
In this mode, the 2 channels will be totally independently encoded. Each channel will have exactly half of the bitrate. This mode is designed for applications like dual languages encoding (ex: English in one channel and French in the other). Using this encoding mode for regular stereo files will result in a lower quality encoding.

...

from AC3 6ch to AC3 2ch just L + R?

Reply #8
Quote
Is there a way to lossless extract just the L + R channel from an AC3 6ch to a new AC3 2ch?

Yes, theoretically. If memory treats me right this is possible. But there's no guarantee that you don't end up with a variable bitrate AC3 stream for reasons Martel mentioned -- unless you also do some padding I suppose.

The other thing is: Do you actually want this? There's a difference between extracting L & R and downmixing to Stereo.

Cheers,
SG

from AC3 6ch to AC3 2ch just L + R?

Reply #9
Yes ... I know.

I make a mistake reporting no other options on my mp3 example.

I intended the dual channel mode, as you have reported.

And I would to especially underline that each channel will have exactly half of the bitrate, to explain that in a 128kbps mp3 file the overall 128kbps is more or less divided by 2 64kbps channels, and not 2 128kbps channels ...

That's it ...


There's a difference between extracting L & R and downmixing to Stereo.


Yes: lossless operation!

For sure I can both downmix (if i like the material on the RL+RR+C+LFE) or just use L+R ... but after that I have a whole flow, right redy to be re-encoded ... and I do not want to re-encode ...

from AC3 6ch to AC3 2ch just L + R?

Reply #10
And what if your L or R channels were coupled  together with some of the channels you wish to drop? You would have to go quite deep into the decoding phase - up to channel decoupling - and re-encode from this point. I think it is MUCH easier to just decode to multichannel PCM, strip some channels, then encode.

from AC3 6ch to AC3 2ch just L + R?

Reply #11
Indeed, Martel. At the end I did just that.
Thank you for all your reply, even to other people.
Raf.

from AC3 6ch to AC3 2ch just L + R?

Reply #12
Few people even know that an mp3 CBR 128 is L 64 kbps + R 64 kbps!

Because it's clearly not. Only a very crude encoder would do this.

from AC3 6ch to AC3 2ch just L + R?

Reply #13
Because it's clearly not. Only a very crude encoder would do this.

I mean, that al lot of "not expert" (of course) people think that 128kbps means 128kbps per channel, and not 128kbps to be the overall bitrate! There's a lot of confision over that ... believe me ...

With the maximum respect Gabriel (you are even a developer, and I am really honored that you and other very experts person have read my topic), but let's not get lost in quibbles... 

from AC3 6ch to AC3 2ch just L + R?

Reply #14

There's a difference between extracting L & R and downmixing to Stereo.

Yes: lossless operation!

I was just making sure that extracting L & R is really what you want. No reason to b*tch.

And what if your L or R channels were coupled  together with some of the channels you wish to drop? You would have to go quite deep into the decoding phase - up to channel decoupling - and re-encode from this point.

Either way you have to do the decoding right down to the quantized samples. Otherwise you wouldn't know where each channel starts and stops within an AC3 frame, IIRC. The channel coupling is actually not a big problem. The only case that might get a bit tricky is the case where only one channel of both L & R is in the "coupled channels" set because the case of only one channel "sharing" the coupling channel might be illegal. Example: Consider L & LS share the coupling channel for upper frequencies in a 5.1 stream. By removing LS,RS and the Center you end up with L,R and the coupling channel which might have to be merged with L. Anyhow, it should still be possible to do it "losslessly" (in the sense that you retain the quality of L & R).

Cheers,
SG