View Full Version : Fix change of channels in ac3
mbcd
18th December 2019, 21:31
Hi Guys, I have a recorded ac3 file here.
It starts as a 2.0 but changes to 5.1 after a while.
So the problems begin, because I want to keep the 5.1 part and also the 2.0 part.
But every program I tried fails. They only read the 2.0 header and progress unchanged on those 5.1 sections.
So my question is: Is there a way on commandline to fix this, there are two prefered ways for me:
1. Insert empty channels into ac3 and change headers to simulate a 5.1 (with silent surround channels).
2. Demux to wav and fill up channels with silence to get a constant 6-channel-wav.
SeeMoreDigital
18th December 2019, 22:04
1. Insert empty channels into ac3 and change headers to simulate a 5.1 (with silent surround channels).Some TV broadcasting companies use this method as it prevents AVR's from flicking between 2 channel and multi-channel modes...
mbcd
18th December 2019, 22:14
Yes, and this is nice to do so, but my file uses the other method, that means I have both channel-configurations in same file which causes lots of problems using it.
But also bad to use this method, you think you get 6 channel, but its only stereo ... cheaters ;-)))))
So any commandline program out there that can fix this to 6ch somehow?
tebasuna51
19th December 2019, 10:50
1. Insert empty channels into ac3 and change headers to simulate a 5.1 (with silent surround channels).
Without decode it to wavs is impossible.
2. Demux to wav and fill up channels with silence to get a constant 6-channel-wav.
But before you need split your ac3 in parts.
Read this:
https://forum.doom9.org/showthread.php?p=1447695#post1447695
https://forum.doom9.org/showthread.php?p=1853648#post1853648
mbcd
19th December 2019, 14:21
@tebasuna51:
Thank you very much for that hint, I will look into it.
I finally got a solution.
ffmpeg is able to handle it.
The file starts with 2.0 and changes to 5.1. ffmpeg identifies it as 2.0 (stereo), but if I decode it to wav an explicit define a 6ch, it takes care of the changes and I get a correct result. It is all handeled correctly I dont loose audio anywhere. But there is no way to identify that is is a 6ch anywhere. No tool is capable to tell that there is a change inside.
hello_hello
20th December 2019, 01:33
In the past I've resorted to DirectShow for that sort of thing. You can specify the number of channels with ffdshow's Mixer filter and that's what it'll output regardless of the input channel count. I know there's a plugin for loading ffdshow in Avisynth directly called ffavisynth.dll, but it's been so long since I've used it I can't remember if it's video-only.
You can achieve the same when converting with foobar2000 by using the Channel Mixer (https://hydrogenaud.io/index.php?topic=29985.0) DSP. I recall there was an issue/oddity with it's up-mixing for a certain channel configuration (can't remember) but in this case you'd disable any up-mixing anyway and just tell it to output 6 channels. The Matrix Mixer (http://skipyrich.com/w/index.php/Foobar2000:Matrix_Mixer) DSP can do the same by adding the left and right channels to the surround/LFE channels at a volume close to silence (it doesn't create channels unless they contain audio).
https://i.postimg.cc/njrFRfPW/mm.gif (https://postimg.cc/njrFRfPW)
Edit: I just realised the bitrate for lossy encoding increases quite a bit when the channels have almost silent audio rather than silence, so I don't recommend the Matrix Mixer method any more.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.