[Matroska-devel] Re: CodecPrivate for MPEG-1 and MPEG-2 video

John Cannon spyder at matroska.org
Wed Nov 17 20:08:10 CET 2004

Steve Lhomme wrote:
> Mike Matsnev a écrit :
>> Steve Lhomme wrote:
>>> OK, let me see what we have :
>>> - The data are needed for decoding
>>> - It can be multiple times in the stream
>>> - It can change during the stream (unimportant data only ?)
>>> - DirectShow decoders need it (separated from the stream ?)
>>> If the only reason to have it is because of DirectShow, maybe we can 
>>> find other ways to do it. It depends if the data are needed when the 
>>> pin is connected or only during playback. If it's during playback 
>>> then we can put the first frame in the codec data and that's it.
>> Sequence header is needed to connect pins.
> It's time to get rid of DirectShow then ;)
> Are there any codec for which you need to feed the first frame in DShow 
> ? That could be an (hacky (as DShow)) option...

The reason behind this is that not all containers specify resolution 
etc. for streams inside.  An example is an MPEG Transport Stream.  The 
decoder must have the sequence header before it can determine the 
resolution.  Of course, this is easily obtained from the stream but some 
frameworks may need to know the resolution BEFORE decoding actually 
begins.  I don't know how DirectShow works but gstreamer is capable of 
running a pipeline before all pins have been connected I believe.  This 
way when the resolution has been determined the next filters can be 
connected.  I see no harm in putting the header itself in the private 
data and just leaving the whole stream intact otherwise.  Also, the 
information which can change in the header(quantizer matrices) is 
crucial to proper decoding so you can't just use one header.

More information about the Matroska-devel mailing list