[FFmpeg-devel] [RFC] stream parsing

Benjamin Larsson banan
Sat Sep 25 11:25:54 CEST 2010


On 09/25/2010 01:53 AM, Michael Niedermayer wrote:
> On Wed, Sep 22, 2010 at 02:02:15AM +0200, Benjamin Larsson wrote:
>> Hi, I've found a few files where the channel layout in the container vs
>> the stream miss matches (1 avi with dts and 1 mkv, issue 2137). That got
>> me thinking about the channel layout mask. In some containers it is
>> possible to just set a channel count, which leads to ffmpeg just
>> guessing the layout. Instead I suggest that when the channel count is >2
>> do a AVSTREAM_PARSE_HEADERS by default instead of trusting the
>> container. So what do you think would that be acceptable? Otherwise I
>> have to add patches like the one in issue 2137 to every demuxer that we
>> find broken files for.
> 
> sounds wrong
> av_find_stream_info() could easily be made to detect the lack of precisse
> channel layout and in this case force at least one frame to be decoded or
> frames to be decoded until it is set. this may or may not need to be
> limited to specific codecs (we dont want too many frames decoded due to
> delay especially for codecs that never could set it so we might need a
> flag in AVCodec then)
> but either way something around av_find_stream_info() seems better than playing
> with parser flags
> 

Yeah the issue is that some codecs don't know the channel count thus you
need the info from the container and sometimes the codec has better
knowledge which could possibly be different from the container (and is
for the 2 files in issue 2137).


So

/**
 * Codec know the channel configuration better then the container
 */

#define CODEC_CAP_CHANNEL_CONF    0x0100


And something in av_find_stream_info that checks that flag ?

MvH
Benjamin Larsson



More information about the ffmpeg-devel mailing list