[FFmpeg-devel] Command-line parameters used too latefor has_codec_parameters()

Alexandre FERRIEUX - FT/RD/SIRP/ASF/SOFTL alexandre.ferrieux
Fri Jan 16 13:36:36 CET 2009


Hi Luca,

>> Currently in av_find_stream_info(), the logic deciding whether or not to 
>> engage into parameter-guessing (by pre-reading several frames), which 
>> calls  has_codec_parameters(), comes _before_ command-line parameters 
>> like -pix_fmt get copied into the fields of the codec.
> 
> I think parameters like width, height, and pixel format are encoded in the
> H.263 bitstream... In particular, I suspect pix_fmt is always PIX_FMT_YUV420P.
> Such value is immediately set in ff_h263_decode_init() (which, if I understand
> well, is called as soon as you start decoding the bitstream). Hence, I think
> that if you see PIX_FMT_NONE after parsing more than 1 frame there is a
> problem somewhere.

OK but if it can be forced (to the same value of course), then the 
command-line param pix_fmt could be used immediately, before reading any 
frame. I understand this is not currently the case in ffmpeg.c, but it 
could be, couldn't it ?


> width and height should also be set as soon as their value appear in the
> bitstream... I suspect there is a frame encoding width and height at the
> beginning of every GOP? (so, after parsing at most one GOP such values should
> be set, I think...).

OK that explains why I need 91 frames when doing the guessing. That must 
be the size of the first, incomplete, GOP in my sample movie (does 91 
sound like a realistic number of frames in a GOP ?).

> Anyway, I think you can set width and height in rtp_parse_open()...
> In this way, av_find_stream_info() should see the parameters as properly set,
> and you have no delay (uhm... You probably also have to set the codec's time
> base).

Will try that, thanks !

-Alex




More information about the ffmpeg-devel mailing list