[MPlayer-users] Re: Constant Visual Quality

Rémi Guyomarch rguyom at pobox.com
Sun Dec 15 02:07:02 CET 2002


On Sat, Dec 14, 2002 at 04:25:35PM -0600, Angel wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> > The per-frame quantizer in mpeg4 *is* an average quantizer.
> 
> Then you're saying that using vqscale=3 does not encode the movie with a 
> constant quantizer of 3 but instead uses an average of 3?

No. I quote D Richard Felker III :

> OK, a quick explanation. The quantizer you set with vqscale=N is the
> per-frame quantizer parameter (aka qp). However, with mpeg4 it's
> allowed (and recommended!) for the encoder to vary the quantizer on a
> per-macroblock (mb) basis (as I understand it, macroblocks are 16x16
> regions composed of 4 8x8 luma blocks and 2 8x8 chroma blocks, u and
> v). To do this, lavc scores each mb with a complexity value and
> weights the quantizer accordingly. However, you can control this
> behavior somewhat with scplx_mask, tcplx_mask, dark_mask, and
> lumi_mask.

So the value you give with vqscale is an average of all MB quantizers
in a particular frame.

> I was under the 
> impression that vqmin and vqmax limit the per-frame quantizer - is this 
> correct?

Yes.

> Or do they limit the per-macro block quantizer.

No.

> If they are per-frame, does that mean the vqmin and vqmax settings
> will have an effect on the per-frame quantizer range it uses when
> specifying a constant quantizer? 

No. Constant quantizer == every frame gets the same per-frame
quantizer. vqmin and vqmax is used when you specify a target global
bitrate.

You must choose between constant quantizer (vqscale), which is a
quality setting, a short-term average bitrate (1-pass mode with
vbitrate) or a target filesize / long-term average bitrate (2-pass
mode with vbitrate in the second pass). In 2-pass mode you can balance
between short-term average bitrate and overall bitrate with vqcomp.

I think what you want is either a float vqscale (1.5, 1.3, 2.2) or a
way to specify per-mb qmin, qmax & qcomp. You can't do that now with
libavcodec but the later may be possible with a short hack (don't know
the libavcodec code enough to be sure). The former, I don't know but
it seems to me that it can't be done in MPEG4.

The problem with clouds or smoke may be the fact that libavcodec
doesn't give enough bits for complex MBs. With per-MB qmin, qmax and
qcomp it might be possible to give more bits for complex MB.

We really need Michael's knowledge here :)

--
Rémi




More information about the MPlayer-users mailing list