[Libav-user] avcodec_open2 is changing the channels and channel_layout... why?
mbradshaw at sorensonmedia.com
Thu Oct 11 23:47:52 CEST 2012
I've just been hunting down a bug in one of our programs, and I
tracked it down to the number of channels reported by ffmpeg. When I
first open the AVFormatContext and do avformat_find_stream_info(), I
can see that my audio stream's AVCodecContext has a reported
channel_layout of 3 (stereo) and channels == 2. However, when I call
avcodec_open2() to start decoding, it changes the streams'
AVCodecContext channel info so that channel_layout is 4 (mono) and
channels == 1! This is causing a crash in a later part of the program,
as one part of the program expects two channels and the other part
expects 1 channel.
1) Is this "expected behavior" in any case, or is it a bug?
2) Under what situations does avcodec_open2 change the channel info?
FYI, I'm opening an MP4 with AAC audio, and I am using FFmpeg 1.0. I
can provide more details, of course, but I'd at least like to know
whether or not avcodec_open2 can change the channel info under certain
circumstances. I've looked at the source of it and there isn't
anything I see that would change both the channel count and channel
More information about the Libav-user