[x264-devel] Is it possible to dynamically change the quality mode using libx264

Jason Garrett-Glaser darkshikari at gmail.com
Mon Oct 26 23:47:29 CET 2009


On Mon, Oct 26, 2009 at 3:42 PM, declan harrison
<harrison.declan at googlemail.com> wrote:
>
>
> On Mon, Oct 26, 2009 at 7:26 PM, Jason Garrett-Glaser
> <darkshikari at gmail.com> wrote:
>>
>> On Mon, Oct 26, 2009 at 12:22 PM, declan harrison
>> <harrison.declan at googlemail.com> wrote:
>> >
>> >
>> > On Mon, Oct 26, 2009 at 7:02 PM, Jason Garrett-Glaser
>> > <darkshikari at gmail.com> wrote:
>> >>
>> >> On Mon, Oct 26, 2009 at 11:12 AM, declan harrison
>> >> <harrison.declan at googlemail.com> wrote:
>> >> > Hi
>> >> >
>> >> > Im using x264 with ffmpeg to encode videos on the fly (realtime with
>> >> > minimum
>> >> > buffering) in a proxy.  So I am working on a HTTP stream and
>> >> > therefore 1
>> >> > pass encoding is the only option available to me.
>> >> >
>> >> > My use case is that after encoding the video for say 10 seconds with
>> >> > a
>> >> > "--crf" value of 22 another network element informs me that I need to
>> >> > increase/decrease the quality of the video stream being sent to the
>> >> > client.
>> >> > I then would like to change the effective "crf" value that I am
>> >> > currently
>> >> > encoding the video stream.
>> >>
>> >> For streaming you need to set a maxrate and bufsize so that you don't
>> >> exceed the bounds of your connection.  If you want absolutely no
>> >> buffer whatsoever, i.e. zero-latency, you need to set bufsize =
>> >> (maxrate / framerate).
>> >>
>> >> x264 currently does not support reconfiguring ratecontrol in realtime,
>> >> but you can re-init the encoder if you want.
>> >>
>> >>
>> > Hi Jason
>> >
>> > So re-init the encoder will this cause many issues for the client or do
>> > you
>> > think that it will pass without much interference?
>>
>> No issues for the client; the primary issue is that of tracking the
>> VBV buffer fullness so that you can init the encoder with the correct
>> initial occupancy for the VBV.
>
> so if I re-init  the encoder will this ensure that all the meta data will
> reflect the new video stream. Im thinking about NAL parameter sets etc?

Re-initting the encoder inherently starts the stream at an IDR frame,
which will involve sending new SPS/PPS as long as b_repeat_headers is
set.

Dark Shikari


More information about the x264-devel mailing list