[MPlayer-cvslog] CVS: main/libmpcodecs ve_lavc.c,1.111,1.112

Loren Merritt lorenm at u.washington.edu
Wed Mar 2 23:02:54 CET 2005

On Wed, 2 Mar 2005, Guillaume Poirier wrote:
> On Wed, 2 Mar 2005 15:08:45 -0500, D Richard Felker III
> <dalias at aerifal.cx> wrote:
>> On Wed, Mar 02, 2005 at 08:28:45PM +0100, Guillaume Poirier CVS wrote:
>> If you're experimenting with this, could you see what happens if you
>> encode pass1 by scaling way down (e.g. 1/2 width and height) with
>> vf_scale, and then encode pass2 at full size? i.e. does the psnr
>> significantly drop? It might be necessary to do some renormalization
>> of the data in the log file for such a hack to work, but I suspect if
>> done correctly it might, and of course it would make another 50%
>> speedup or something...

Good idea, but I think "renormalization" would be nontrivial: The amount 
of bitrate you save by downscaling depends on the amount of detail and/or 
noise in the video.
So for a very fast 1st pass, I suggest the following:
Encode the whole video using fast settings and/or lower resolution. 
Additionally, encode some small fraction of the frames at full quality (in 
groups, e.g. 10-20 consecutive frames here and there). This gives you both 
an approximate bitrate curve for 2pass allocation, and also an estimate of 
how much to multiply the 1st pass bitrate by to compensate for the turbo.
Disadvantage: I think this would need some code in lavc, not just in 

This idea was inspired in part by AutoGK's compression test, and in part 
by x264's B-frame decision.

> As far as the renormalization is concerned, I guess a constant-quant
> (like vqscale=2) encode for the first pass could do the trick,
> couldn't it?
> Well, reading x264's section of the manpages, it kind of states that
> should a first pass be done with constant quants, it's better if the
> constant quant used is close to average quants in the resulting video,
> so I don't know what I should do...

The 1st pass should be as close as possible to the distribution of quants 
used in the 2nd pass. x264's 2pass is closer to CQP than it is to CBR. But 
even better would be a 1pass VBR mode that uses the same curve compression 
as 2pass.
(BTW, I recommend vqcomp=.6 or .7 in lavc too, in which case CQP 1st pass 
becomes good there too.)

--Loren Merritt

More information about the MPlayer-cvslog mailing list