[Ffmpeg-devel] How to get the current bitrate?

Luca Abeni lucabe72
Thu Jul 28 16:27:13 CEST 2005

Hi all,

I need to stream some compressed audio/video over a network with limited
bandwidth (there actually is a bandwidth shaper), so I am trying to
understand how the rate control in libavcodec works...

If I set rc_max_rate and rc_buffer_size, I see that the encoded stream
"kind of respects" the maximum rate, but there sometimes are spikes over
such limit (I am using MPEG4 video, single-pass encoding).

I am trying to understand such spikes and to do this I am currently
using tcpstat to monitor the actual bitrate streamed to the network.
But I'd like to read the "current" bitrate (not the average one)
directly from the codec... To respect the "maximum rate" constraint
libavcodec needs some kind of estimation of the current bitrate, right?
Is it possible to read it in some way?

Also, does anyone know if it's possible to make the rate control more
precise/effective by playing with the codec's parameters? (I see
rc_buffer_aggressivity, rc_eq, bit_rate_tolerance, ... But I do not know
how to use them).

Copy this in your signature, if you think it is important:
                               N O    W A R ! ! !

More information about the ffmpeg-devel mailing list