[FFmpeg-devel] Why does vp56_init() sets avctx->width and avctx->height to 0?

Aurelien Jacobs aurel
Sun Aug 31 16:12:36 CEST 2008

On Sat, 30 Aug 2008 14:58:21 -0700
Baptiste Coudurier <baptiste.coudurier at smartjog.com> wrote:

> Hi Aurelien,
> Aurelien Jacobs wrote:
> > Stefano Sabatini wrote:
> > 
> >> Hi,
> >>
> >> this causes a bug both in ffprobe (prints widht=size=0) and causes a
> >> division by 0 exception in libavfilter/vf_scale when it tryies to the
> >> parameters for the filter.
> >>
> >> What's the point into setting those values to 0?
> > 
> > The point is that the actual frame width and height are not known
> > at this point. They only get known after parsing the header of the
> > first key frame.
> > And also don't forget that those value may change at every key frame.
> > The width/height is not an intrinsic property of a video stream, it's
> > a property of each individual frames.
> > 
> Any reason to _set_ them to 0 instead of leaving them "as is" and set
> them during decoding like every other decoder do ?

The reason is that it forces the size change detection to triger
in vp6_parse_header() for the first frame. It would be possible to
do it differently. For example, vp56_init() could just set a flag
and vp6_parse_header() could triger size change detection when this
flag is set.
I could do it if requested, but that won't change the fact that frame
size is not an immutable property of a decoder, and shouldn't be
treated as such.


More information about the ffmpeg-devel mailing list