[Libav-user] avcodec_open2 is changing the channels and channel_layout... why?

Michael Bradshaw mbradshaw at sorensonmedia.com
Fri Oct 12 01:09:28 CEST 2012

On Thu, Oct 11, 2012 at 4:49 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Michael Bradshaw <mbradshaw at ...> writes:
>> > While I cannot really answer the question, I wonder
>> > what you expect when the number of channels really change:
>> > At least for AC-3 and AAC, this is not only allowed,
>> > but happens regularly (for example on DVB).
>> Really? That's useful to know. I suppose I should rely on
>> AVFrame.channels, correct?
>> While that's useful to know, I don't think it this
>> AAC stream changes channels.
> I did not want to imply that what happens cannot be a bug,
> I just wanted to make sure you know that channel count
> (and channel layout) may change.

I know, and thank you for that. But I can rely on AVFrame.channels, right?

> Did you verify if the problem is not that container and
> stream have different opinions about the number of channels?

I've tried remuxing it with ffmpeg -i MP4-Apple264-AACPlus.mp4 -acodec
copy -vn out.aac and now ffprobe -show_streams reports 2 streams.

> (What does QuickTime say about the number of channels?)

QuickTime reports it as mono. So does Windows Media Player. It plays
ok in ffplay and QuickTime though (didn't try Windows Media Player).

Seeing as remuxing the audio stream to plain .aac seems to have fixed
the issue, I'm thinking the container might be bad. Do you know of any
tools or options in ffmpeg to help validate that conclusion?



More information about the Libav-user mailing list