[MPlayer-users] Re: spurious blockiness when transcoding high-bitrate mpeg2 to med-bitrate mpeg4

Jason Tackaberry tack at sault.org
Sat Jul 3 16:47:31 CEST 2004


On Sat, 2004-07-03 at 15:02 +0200, Simen Thoresen wrote:
> My grab is interlaced - I don't see this when I play it using tv-out, but I 
> would rather have my archived file be computer-playable as well. Appart from 
> deinterlacing, I have not given much thoughts to the filters. I guess hb, vb 

Are you sure the source isn't telecined?  If so, deinterlacing that will
result in a real mess.  If it's a movie that was shot on film, what you
have is probably telecined, and so you should use one of the pullup
filters rather than deinterlace.  (I recommend -vf pullup,softskip if
your mencoder is new enough.  Otherwise -vf filmdint is probably good.)

Read the guide to determine what you have and how to deal with it:

   http://www.mplayerhq.hu/DOCS/HTML/en/menc-feat-telecine.html

> I tried to add vb_strategy=2 as you suggested, and the problem got less 
> noticeable, but did not disappear in my excerpt before I also removed the dr 
> and al filter (which did cause a few of the scenes to seem a bit overexposed).

(Ok, you meant vqscale=2.)  If the problem lessens when you use
vqscale=2 versus a two-pass, then that means your bitrate is too low.
In this case, either increase bitrate, or try scaling the video down to
a smaller size before encoding.  (Or, perhaps do both to lesser
degrees.)

As for blocky artifacts, there are a couple ways to deal with this.
First, as Nico suggested, adding noise during playback is a very
effective way to improve the perceptible quality.  MPlayer also has the
spp filter.

   mplayer movie_with_slight_blockiness.avi -vf spp=2,noise=8ah:5ah

There are a few things you can do to improve the quality of your rip
though.  Your mencoder command line was:

> mencoder partial.mpg -o partial.avi -mc 0 -ovc lavc -lavcopts 
> vcodec=mpeg4:vbitrate=1200:mbd=2:v4mv:keyint=132:vb_strategy=1:vpass=2
> -oac mp3lame -lameopts preset=192 -vf pp=hb/vb/dr/al/lb

vb_strategy isn't going to make any difference here because you haven't
specified vmax_b_frames, which by default is 0.  You can experiment with
B-frames, as they might improve the quality with a two-pass encode.
(It's sometimes hit-and-miss with B-frames.)  Use vmax_b_frames=2:
vb_strategy=1.

You're also not using trellis quantization (trell).  This is an option
you should never leave out, IMO.  Also, the default macroblock
comparison function isn't as good as the others, so you should specify
one.  3 is a good one to use.  At bitrates lower than say 1600 or so,
I'd also try mv0.

I would not specify any of the pp filters that you used above,
particularly if the source is telecined (which I suspect it is, if it's
a movie).

You probably should be cropping, too.  If your source video has any
black bands and you are encoding these, you're going to lower the
quality of your rip -- probably a lot too, at a relatively low bitrate
like 1200.

So what you have is something like:

mencoder partial.mpg -o partial.avi -mc 0 -ovc lavc -lavcopts \
vcodec=mpeg4:vbitrate=1200:mbd=2:v4mv:trell:mv0:cmp=3:subcmp=3:mbcmp=3:vmax_b_frames=2:vb_strategy=1:vpass=1|2 \
-oac mp3lame -lameopts preset=192 -vf pullup,softskip,crop=XX:XX:XX:XX

If you're still not happy with the result as far as blockiness goes, and
increasing the bitrate to say 1400-1600 and/or scaling isn't making it
look any better than vqscale=2, then you can try the NSSE cmp function
(cmp=10:subcmp=10:mbcmp=10:dia=3) instead of DCT (cmp=3).  I find this
helps significantly, although the overall PSNR is lower (so examine your
results carefully) and it may not work as well at lower bitrates.  But
it's certainly worth trying.  You'll need CVS mplayer for NSSE.

I've written a guide on encoding that I'm working to get included into
the docs.  I've repeated a lot of it here, but it may have other
information that helps.  It can temporarily be viewed here:

   http://sault.org/~tack/menc-feat-dvd-mpeg4.html

Good luck,
Jason.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-users/attachments/20040703/53db98e0/attachment.pgp>


More information about the MPlayer-users mailing list