[MPlayer-users] variable bitrate, fixed quality

D Richard Felker III dalias at aerifal.cx
Wed Jul 9 02:41:56 CEST 2003


On Tue, Jul 08, 2003 at 12:06:27AM +0200, Nikolaus Rath wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> D. Richard Felker, III <dalias at aerifal.cx> wrote:
> > [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> > On Mon, Jul 07, 2003 at 07:54:07PM +0200, Nikolaus Rath wrote:
> >> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> >> Hans Meine <hans_meine at gmx.net> wrote:
> >> > [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> >> > On Monday 07 July 2003 18:49, Nikolaus Rath wrote:
> >> >> I want to encode a video with a completely variable bitrate but with a
> >> >> fixed quality. I don't want to use a fixed quantizer too, because this
> >> > 
> >> > The bitrate is what you are looking for. Using 2-pass encoding will try to 
> >> > achieve constant quality. If you don't want to constrain the quality, specify 
> >> > an enormous bitrate (recall that bitrates above some value are not kbits 
> >> > anymore, but bits, so add some more zeroes) and lavc will do as good as it 
> >> > can.
> >> 
> >> This doesn't work. I tried it and lavc compressed nearly all frames
> >> with a quantizer of 3, even if most of them would be perfect with 6. I
> > 
> > They're NOT perfect with 6. Your eyes just can't tell the difference.
> > Write a program that will determine when your eyes could tell the
> > difference, and when they wouldn't, and then we'll incorporate it into
> > lavc... :))
> 
> Do I understand correct: lavc cannot recognise if a frame looks better
> or worse with a specific quantizer? But how does lavc decide which
> quantizer to use in this case?

Correct. Rate control engines like lavc's are much simpler than you
would think. During pass 1 or single pass encoding, they simply
increase the quantizer whenever the output bitrate is getting too
high, and decrease it when the output bitrate gets low again.

If you do 2 pass encoding (which you should be doing!!! if you're not,
don't complain about quality!!!!) then the situation is a little
better. The rate control engine will look at the list of quantizers
and number of bits used for each frame from the first pass, and take
some bits away from frames that already have very low quantizers (by
increasing the quantizer for them) so that is can improve the quality
of frames that received high quantizers during pass 1.

> Maybe I described my problem the wrong way. I will retry:
> 
> I encoded a file with a fixed bitrate of 1500. Most of the video
> looked good (I call these parts the "simple"), but some parts looked
> bad (I call these "complex"). Now I increased the bitrate. The result
> was good, but the video was much bigger than necessary because the
> simple frames were encoded with a lower quantizer too. I'm searching
> for a way to increase the bitrate just for the complex parts of the
> video, where it is really necessary. 

Normally 2-pass encoding accomplishes this just fine.

> According to an xvid page (http://roeder.goe.net/%7Ekoepi/xvid.shtml,
> the "XViD Options Explained" PDF), the xvid codec supports such an
> operation. The page says that I should set the "curve compression" to
> 0 or 1 and the "payback delay" to 1. But these are the parameter
> names in a different xvid gui, I can't find them in mencoder. So maybe
> someone can tell me the equivalent mencoder options?

The corresponding options for lavc are vqcomp, vqblur, vqsquish,
vratetol, vrc_maxrate, vrc_minrate. However, the defaults are rather
good. Increasing vqcomp (default is 0.5) to something near 1 will make
quality more steady for the whole movie. Decreasing it will make
bitrate more steady (close to constant bitrate).

Rich



More information about the MPlayer-users mailing list