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

Simen Thoresen simentt at dolphinics.no
Sat Jul 3 18:44:23 CEST 2004


Hi Jason,

Thank you for the links, I'm looking at them now.

I'm not sure if my source is not interlaced; It is /originally/ a 
cinema-picture, distributed on laserdisk. My mpeg2-source is from a hauppage 
PCR250 card that can perform inverse telecine while encoding. I'll try to 
grab the movie anew with this enabled.



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.

I tried that one in between here, and am currently using it.

 > 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.

Ok,
mv0:mbcmp=3 added.

 > 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).

I'll ask my PVR-card for a de-telecined grab. Reducing the framerate from 
~30 to ~24 should also help me get the bitrade down a bit ;-)

 > 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.

I would crop on the PVR card too, I think, but this movie is fullscreen.

 > 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

Yup, appart from the filters;

mencoder $1 -o $2 -mc 0 \
      -ovc lavc -lavcopts \
      vcodec=mpeg4:vbitrate=1200:mbd=2:v4mv:keyint=132:
      vb_strategy=1:vmax_b_frames=2:trell:mv0:mbcmp=3:vpass=$PASS \
      -oac mp3lame -lameopts preset=192 \
      -vf pp=md/lb/ci/li/fd

(I'll change the filters when I get my new grab)

Hm. I see you've added cmp and subcmp as well - why not precmp too?

 > 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'm not sure if increasing the bitrate would help much - my transcode as I 
started this was very good as far as I could see, except for the few places 
where it suddenly crapped out on me. It is probably my limited understanding 
of the encoding process, but I would rather think there was a problem with 
the encoding than the encoder depleting it's bps budget. Still - I'll have a 
look at my last encode, try another one with the vf's you suggested, and 
then re-grab the LD with the PVR-card doing inverse telecine and have a new 
look at that - I suspect that if the main problem here is with the telecine, 
then the problem will mostly have solved itself when I get that grab done.

 > 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.

Thank you too for your help. I've played around a fair bit with mplayer and 
mencoder, but this is the first time I try to make high-quality transcodes.

Yours,
-S

-- 
Simen Thoresen, Wulfkit Support, Dolphin ICS
http://www.tysland.com/~simentt/cluster




More information about the MPlayer-users mailing list