Benjamin Larsson <[email protected]> added the comment: Justin Ruggles wrote: > Justin Ruggles <[email protected]> added the comment: > > So what happens is that when the stream changes to stereo, the decoder > will start outputting stereo. The audio seems correct though. But > since the output format is wav, it expects everything to be the same > channel layout. So when it changes to stereo, it throws off the channel > order. So after that point the channels are interpreted as Rs, LFE, L, > C, R, Ls instead of L, C, R, Ls, Rs, LFE. > > The next question is, should FFmpeg do anything about this? When the > mid-stream switch is the other way (stereo->5.1->stereo) we handle it by > downmixing the 5.1 content to match. But in this case we don't upmix > the stereo content to match the 5.1 content. We just change > AVCodecContext.channels to 2 and start outputting stereo. >
The proper way to do things is to let the decoder output the data in the channels that where requested or when the decoder doesn't downmix in full configuration. The audio path should then up/down mix to the requested out configuration. When the configuration is changed an event should be generated so that applications can reconfigure the audio path if they want. In this case the stereo frames would just be upmixed and everything would be ok. For a dvb viewing application it might reconfigure the audio path to match the kind of input that currently is streamed (ie program with 5.1 is broadcasted and there is a commercial break with stereo). MvH Benjamin Larsson ________________________________________________ FFmpeg issue tracker <[email protected]> <https://roundup.ffmpeg.org/issue1850> ________________________________________________
