[MPlayer-users] Re: Some information needed from the experts of mencoder

Jonathan Rogers jonner at teegra.net
Tue Jul 1 13:42:55 CEST 2003


Vijay gill wrote:
>     I have recently shifted to encoding divx's using mencoder. I am
> extrememely happy with the encoding speed and quality that I get with it.
> But I have a few questions:
> 1)    I use lavccodec with mpeg4 as codec : How do the pass 1 and pass 2
> work in this case?

Have you read the manpage?

> 2)    I uses qpel for quarter pixel motion compensation. But colours start
> spilling from one object to other. Is there any way to remoe this effect
> other than not using qpel?

How are you playing the result? I use qpel all the time and I've never 
seen this when playing the result with MPlayer or Xine (which use 
libavcodec for decoding). A decoder that doesn't implement the whole 
MPEG-4 video spec correctly may mess up. Many *nix players use 
libavcodec for decoding and there are libavcodec VFW and DirectShow 
plugins/filters for Windoze, so there's precious little excuse for not 
using the best Free implementation, IMHO everywhere.

> 3)    Finally even if I do not give any options to -lavcopts parameter, I
> get divx compatible movie and quality is excellent, and rame rate of
> conversiojn is at it's peak. How does this work out because the
> documentation says I must atleast provide divx4/mpeg4 parameter
> to -lavcopts.
> 
> Also please share your settings of command line parameters with me to get
> the best quality(if there is any more scope of getting it - I think I am
> already getting the best).
> 

Have you read "DOCS/tech/encoding-tips.txt"? That's where I got started. 
Make sure to check out the links at the top of the file. I especially 
found the lavc benchmarks page useful (now, it's at 
<URL:http://rguyom.ath.cx/>). Currently, for the first pass, I'm using:

vcodec=mpeg4:vhq:vlelim=-4:vcelim=7:lumi_mask=0.03:dark_mask=0.005: 
vmax_b_frames=1:v4mv:precmp=2:cmp=2:subcmp=2:trell:vb_qfactor=1.25: 
vb_qoffset=0.6:qpel:autoaspect:psnr:naq:vqcomp=0.8:vqscale=3:vpass=1

For the second, I'm using:

vcodec=mpeg4:vhq:vlelim=-4:vcelim=7:lumi_mask=0.03:dark_mask=0.005: 
vmax_b_frames=1:v4mv:precmp=2:cmp=2:subcmp=2:trell:vb_qfactor=1.25: 
vb_qoffset=0.6:qpel:autoaspect:psnr:naq:vqcomp=0.8:vbitrate=1034: 
vdpart:vpsize=1000:vpass=2

Keep in mind that I'm using very recent CVS libavcodec and mplayer. In 
particular, I think you need to use CVS to get autoscale, though it 
doesn't directly affect image quality. If you've been watching this 
list, you will have seen the discussion about vqscale. I used 
"vqscale=3" because the average quantizer is closest to three in the 
final result. This has increased my PSNR slightly compared to the method 
suggested in encoding-tips. You may need to experiment to find the best 
one. Also, be aware that these options may divide the encoding rate by 
three or four, compared to the defaults.

As with anything as complex as optimal lossy video coding, YMMV. IANAVCE 
(I am not a video coding expert) and most of my options I'm using just 
because others have suggested them. Many of the available options are 
still very mysterious to me, and I intend to learn more about what they 
mean. I'm sure this will require learning details about video encoding 
and reading mencoder and libavcodec source. I've asked questions about 
these options before on this list and sometimes gotten useful answers 
from people who know more than I do. However, there still seems to be a 
lot of magic involved. Actually, this is probably not the best place to 
discuss these issues. Perhaps one of the ffmpeg lists would be more 
appropriate.

Libavcodec doesn't try to guess at reasonable defaults, unlike DivX and 
XviD. Instead, it expects the user to know what he's doing. Keep in mind 
that its primary purpose is realtime encoding, which is why a number of 
options need to be explicitly enabled to get the best quality.

A number of the lavcopts seem to be tradeoffs between encoding time and 
quality, like vhq, v4mv, qpel, trell, and *cmp. Others, like *elim and 
*mask, seem to be subjective tradeoffs between different aspects of 
visual quality. Don't take my word for it; read all the sources you can 
find and do your own experiments. I'm also still actively pursuing 
methods of obtaining optimal quality/bpp.

Jonathan Rogers



More information about the MPlayer-users mailing list