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

Måns Rullgård mru
Thu Jul 28 17:42:49 CEST 2005

Luca Abeni said:
> 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?

You should be streaming at a constant rate, no matter what the instantaneous
rate of the video is.  That's what the RC buffer is all about.

M?ns Rullg?rd
mru at inprovide.com

More information about the ffmpeg-devel mailing list