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

Loren Merritt lorenm at u.washington.edu
Mon Jan 12 13:31:12 CET 2009

On Mon, 12 Jan 2009, Jarmo Torvinen wrote:

> I see some problems with this approach:
> 1) it is too time consuming to call the x264_encoder_reconfig() just for
> 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 at 
most once per GOP. I don't see the problem.

> 3) according to initial tests, the aspect ratio changes, but the timing
> is not always correct. This is because the aspect ratio info is sent in
> 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 sending
> 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.

--Loren Merritt

More information about the x264-devel mailing list