[x264-devel] Reconfiguring x264 aspect ratio in the middle of stream

Jarmo Torvinen jarmo.torvinen at jutel.fi
Mon Jan 12 15:14:15 CET 2009

> > I see some problems with this approach:
> >
> > 1) it is too time consuming to call the x264_encoder_reconfig() just 
> > the purpose of changing the aspect ratio, I'd rather have separate API
> > function which just would do that.  But on the other hand, is there
> > enough justification to add another api call just for that purpose?
> x264_encoder_reconfig takes 7k cycles (2 microseconds), and you call it 
> most once per GOP. I don't see the problem.


> > 3) according to initial tests, the aspect ratio changes, but the 
> > is not always correct. This is because the aspect ratio info is sent 
> > the SPS, so the timing depends on the timing of the scene cut. To have
> > correct timing, there should be some way to force a scenecut or 
> > a SPS through the API when the aspect ratio changes.
> x264_picture_t->i_type = X264_TYPE_IDR
> What isn't guaranteed is that reconfig changes take place on the same 
> frame they're input with, as opposed to whatever frame is encoded next.

Thanks for the tip. I tried to set that parameter but unfortunately it 
seems that the
parameter is ignored in a call to x264_encoder_encode(). 
Maybe this comment in x264.h (struct x264_picture_t) is valid?


/* In: force picture type (if not auto) XXX: ignored for now
* Out: type of the picture encoded */
    int     i_type;



More information about the x264-devel mailing list