[x264-devel] x264 bitrate adjustment latency
Samuel Hurst
samuelh at rd.bbc.co.uk
Fri May 13 09:07:52 UTC 2022
Hello,
Apologies if this isn't the correct place to ask this question, but I
couldn't find a better place and there doesn't seem to be an x264
section on the VideoLAN forum to ask this sort of question, and I was
recommended to ask directly here.
I've been experimenting with congestion control for live RTP in
GStreamer, where the bit rate of the encoder is changed dynamically in
respose to network conditions. The issue I've been having is that x264
seems to take a while (1-2 seconds) to react to the bit rate property
being updated, which results in the congestion controller panicking and
ramping the output of the encoder down further and further as it
continues to see congestion from the encoder bursting it's bit rate budget.
I have been using the x264enc element in GStreamer [1], which uses the
x264 library directly underneath, and seems to wrap several x264 options
into it's own interface. It also offers the option to pass other options
through to the underlying library directly, but I haven't used that yet.
I've been graphing the output to understand the time between the target
bit rate being set and the new rate taking effect. I've been producing
graphs like the one in [2], which show the configured bit rate in gold,
the average bit rate measured every second in red and the size of every
encoded frame in blue. Looking at the graph, there's at least a second
before the size of each encoded frame starts to trend downwards, which
is where I think my problem lies.
Do you have any suggestions of settings that I could change to reduce
the time that it takes for x264 to start reducing it's bit rate? I've
already tried reducing the KeyInt value to as low as 10, but that
doesn't seem to help. I have also tried increasing the qpstep parameter,
as well as lowering the rc-lookahead and vbv-bufsize parameters, but
nothing seems to help.
I'm using the version of x264 in the Ubuntu 22.04 repositories [3],
which Canonical refer to as version 163, but I'm not sure how that
relates to what's in the VideoLAN GitLab repository.
I'd appreciate any pointers or help that you can give.
Best regards,
-Sam
[1]: https://gstreamer.freedesktop.org/documentation/x264/index.html
[2]:
https://www.dropbox.com/s/d9sxya0mr00j5np/x264-buffer-bitrate-test-idr-25-10mb-to-8mb.png?dl=0
[3]: https://packages.ubuntu.com/jammy/libx264-163
More information about the x264-devel
mailing list