[MEncoder-users] encoding technical question
A. Schmid
sahib at phreaker.net
Thu May 15 11:11:45 CEST 2008
Philippe MONROUX wrote:
> De (from) (von) <bugfood-ml at fatooh.org> :
>
>> Philippe MONROUX wrote:
>>>> 2) Unless I am very much mistaken, CQ will not give you predictable
>>>> file sizes, since it will use whatever bitrate is needed to provide
>>>> the quality specified., so the basis of your question is flawed. In
>>>> my experience, the only way to achieve a fixed final file size is to
>>>> do two pass encoding specifying bitrate, not CQ or CR.
>>> Sure but, read in doc :
>>>
>>> resolution x CQ = (bitrate x 1000)/25 (if 25 fps)
>> Where is this written?
>
> Here :
> http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-dvd-mpeg4.html#menc-feat-dvd-mpeg4-resolution-bitrate-compute
I think there was some confusion with the CQ, which means "compression
quality" in this document. It is stated clearly that "CQ represents the
number of bits per pixel and per frame of the encode".
This means CQ ist in fact an way to talk about constant _bitrate_, not
constant quantizer (or "constant quality") - which is also abbreviated
"CQ" but means variable bitrate.
So just replace CQ with BPP (bits per pixel) and everything should be fine.
> The ResY formula (without 16 rounding) is
>
> ResY = SQRT( 1000*Bitrate/(25*ARc*CQ)) or
>
> (ResY)^2 = 1000*Bitrate/(25*ARc*CQ) or
>
> CQ*ARc*(ResY)^2 = 1000*Bitrate/25
>
> And since ResX = ResY * ARc (without 16 rounding too) that give :
>
> CQ*(ResX/ResY)*(ResY)^2 = 1000*Bitrate/25
> CQ*ResX*ResY = 1000*Bitrate/25
This formula has some truth in it, but I wouldn't take it for THE
perfect formula that always gives a perfect encoding.
It has been found out, that BPP values between 0.1 and 0.3 are the only
sane values (for today's codecs).
In http://www.mplayerhq.hu/DOCS/tech/encoding-tips.txt you can read:
< 0.10: don't do it. Please. I beg you!
< 0.15: It will look bad.
< 0.20: You will notice blocks, but it will look ok.
< 0.25: It will look really good.
> 0.25: It won't really improve visually.
> 0.30: Don't do that either - try a bigger resolution instead.
You formulas just calculate the resolution, based on the BPP you want
(quality) and the bitrate you wish to spend (size), while keeping an eye
on video and pixel aspect ratios.
This is a little problematic, because clearly quality and filesize _must
be_ conflicting properties! When keeping the original resolution, you
can only choose one of them (as you somehow do with constant
quantizer/VBR (choosing quality) opposed to constant bitrate/CBR/ABR
(choosing size)), the other one then depends on the first one.
The author finds a way out of this dilemma by varying the resolution. Of
course this works, but a lower resolution also means less detail, very
much like higher compression. So in the end it boils down to filesize
versus quality, again.
As for your original question: I would suspect that 600x200 with CQ=0.10
will look just as bad as 450x150 with CQ=0.177 _on average_ depending on
the movie characteristics).
The difference is, that the latter will have less artifacts! Both will
lose about the same amount of detail (the first because of higher
quantizers, cutting off more of the high frequencies, the second because
of the sampling theorem, which just "forgets" about the high frequencies
and leaves more bits for encoding the low ones).
It's just that you don't see the lost frequencies on nicely (= low pass
filtered) scaled down images, whereas you DO see blocking artifacts on
images with quantizers too large!
This means the hi-res/low-bpp approach looks better on images where you
need fine details but little motion (e.g. presentations),
low-res/high-bpp looks better on high motion scenes where fine details
aren't important (e.g. action movies).
Regards
Alex
More information about the MEncoder-users
mailing list