[Ffmpeg-devel] calculating optimal bitrates

Karl H. Beckers karl.h.beckers
Fri Oct 27 20:52:26 CEST 2006

Hi all,

am trying to find an algorithm for determining a good bitrate based on
let's say a percentual quality I want to achieve (kinda like when saving
jpegs) and would appreciate if anybody could comment on the validity of
the lines along which I'm thinking. 

I thought I already had a tolerable algo and was struck by the fact that
even at a 10% quality configured I was getting perfect results (with
little movement ....).

So, if my frames are 100 x 100, I have 10000 pixels.
Let's say I have YUV, then that's 160000 bits per frame, at 10 fps it
would be 1600000 bits per second.
If I have a gop_size of 50, I have 0.2 intra frames per second, so I
need 32000 bits per second for intra frames.

Does that mean that at this frame size with a bit rate of 32000 and no
movement I will get perfect results? It would then follow that whatever
I add to the bitrate is available for b-frames to actually encode
movement and the quality achievable with any given bitrate (higher than
what's necessary to accomodate the intra frames) depends on the amount
of change you have between the intra frames. In other words: There is no
way to determine the quality you can achieve with a bitrate from the
frame size an gop_size unless you also make an assumption on the degree
of change you'll be seeing?



More information about the ffmpeg-devel mailing list