[Ffmpeg-devel] qp offsets (i,b,p)

Loren Merritt lorenm
Tue May 17 20:16:37 CEST 2005


On Tue, 17 May 2005, Rich Felker wrote:
> On Tue, May 17, 2005 at 04:03:08PM +0300, Tuukka Toivonen wrote:
>> ffmpeg has options -b_qfactor, -i_qoffset, etc.
>> They modify the QP (quantization parameter) value between different types
>> of frames. Obviously this sometimes help, or the arguments wouldn't be
>> there.
[...]
> As for I frames, they're very large, and if you want to keep bitrate
> tightly constrained, you may want to use higher qp.

Yes. Though that should be a job for internal ratecontrol, not a priori 
qp offsets.

> Also, it's probably ok to use slightly higher qp on I frames, since
> whatever error you get from quantization will just be DCT noise
> (ringing), not muddy crap from the motion estimation. In other
> words, error in the DCT coefficients of the complete block is less
> annoying than error in the DCT coefficients of the error residue
> after motion est.

I've found it to be the opposite. The reason I-frames are much 
bigger than P-frames is that P-frames can reuse information from 
the I-frames. Assuming decent motion compensation, most of the 
information that you don't encode in the I-frame (due to giving it 
a high qp) just has to be encoded in the following P-frame if it has 
lower qp. And it takes more bits per quality to split the 
information among two frames than to encode it all at once.

So much so, that in x264, when I compare a constant qp encode 
with and without I-frame bonus, I often see a reduction in total 
filesize when the I-qps are set below the P-qps, despite increasing 
the size of the I-frames.

>> Or actually: is anyone aware of any research papers, webpages, books, or
>> anything (keywords for google, I found nothing useful), that would
>> 1) explain why changing the QP helps
>> 2) give algorithm for selecting QP offsets automatically

I have encountered several, but all attempted either constant 
bits-per-frame or constant PSNR. Neither of which IMHO is desirable
(see my section on ratecontrol in MPlayer's encoding tips).

--Loren Merritt





More information about the ffmpeg-devel mailing list