PDA

View Full Version : Strange distortion while panning


Itness
2nd October 2008, 20:07
I've done a lot of XviD encoding, generally from DVD and VHS sources, and although my latest encode looks fine generally, there is a strange distortion that is only obvious when the camera is panning -- doesn't seem to matter whether it's panning top to bottom or left to right.

Here is a sample unprocessed clip:

http://rapidshare.com/files/150305338/itness_clip.m2v

My initial encode used tdeint/nnedi, tfm.tdecimate and mc_spuds (see script below) and the results looked good overall except in the panning shots. The clip shows a downward pan with a narrow tower in the foreground. The size and shape of the tower seems to modulate irregularly from one frame to the next during panning. For example, the left side of the tower moves but the right side remains stationary, and the whole tower seems to shrink vertically between one frame and the next.

I've experimented with encoding this clip in many ways: with and without decimation (it's NTSC bff), using tdeint/nnedi, mcbob, mvbob, and tempgaussmc. Nothing thus far has eliminated the distortion.

My initial script:

LoadPlugin("C:\AviSynthPlugins\DGDecode.dll")
LoadPlugin etc.
mpeg2source("X:\BLAH\film.d2v")
Interp = NNEDI(field=0)
Deinted = TDeint(order=0,field=0,edeint=Interp)
TFM(mode=6,order=0,PP=7,slow=2,mChroma=true,Clip2=Deinted)
TDecimate()
MC_Spuds(frames=2,strength=3,sharpp=2,lsfstr=120)
crop(10,0,700,476)
Spline36Resize(640,480)

Here is more or less the same clip (just a few frames difference) processed with the above script:

http://rapidshare.com/files/150305750/itness_clip.avi

Any suggestions would be greatly appreciated.

Didée
3rd October 2008, 17:05
Your source is not telecined FILM, but a fieldblended normconversion. You cannot IVTC that.

Have a look at the output of

mpeg2source("X:\BLAH\film.d2v")
return( bob() )

to see what actually is going on. The distortion you're talking about is not introduced by your filterchain, it is already in the source.

You could give a try on MRestore or SRestore (contained in "R_pack" of MOmonster) to revert the fieldblending, but it's doubtful if anything can deal reasonably with this crappy source. Crap in, crap out, old story.

Didée
3rd October 2008, 20:35
Had a 2nd look at the source, and it's a really strange one. Some kind of "swich mode" conversion seems to have been used. The usual "blend/clean/blend/clean..." pattern has a different phase in the top half of fields, compared to the bottom half. Interesting, can't remember to ever have seen something like that.

The following does work, more or less:

import("J:\_UnderWork\R_pack\mrestore_2007-12-08.avs") # a bit old, I know

Mpeg2Source("F:\itness_clip.d2v")

bob(0,0.5)
top = crop(0,0,-0,240)
bot = crop(0,240,-0,-0)

top + bot

x = reduceflicker(strength=1)
MRestore(numr=2,denm=5,dclip=x)

top2 = trim(0,framecount(last)/2)
bot2 = trim(framecount(last)/2,0)

stackvertical(top2,bot2)
framecache(8) # WarpSharp package

Temporaldegrain(degrain=1,sigma=8,hq=0,SAD1=8000) # just for fun, replaced
#MC_Spuds(frames=2,strength=3,sharpp=2,lsfstr=120) # with another denoiser :P
crop(10,0,700,476)
Spline36Resize(640,480)


... and the result is this here (http://rapidshare.com/files/150620240/splitted_mrestore.avi.html).

Note that there *will* be issues because the "top halfs" and "bottom halfs" are blend-restored independently. This may lead to both halfs being out of synch, i.e. in the end result the bottom half of a frame may sometimes be from the frame before or from the frame after, instead from the current one.

Sink or swim, I've no better idea than this one.

Itness
12th October 2008, 04:27
A belated thank you, Didee, for trying to solve my dilemma.

And thank you for clarifying the problem with the source.

Your script doesn't seem to help with the distortion during horizontal panning, unfortunately. And as you suggested, there are some frames whose top half is from the frame just before a scene change, while the bottom half is after the scene change, or vice versa.

http://i205.photobucket.com/albums/bb28/barronovsky/naughty%20pix/th_frame1.jpg http://i205.photobucket.com/albums/bb28/barronovsky/naughty%20pix/th_frame2.jpg

Here is another unprocessed clip from the same source that has a right to left pan:

http://rapidshare.com/files/153133713/itness_clip2.m2v

And here is the same clip encoded using your suggested script, except that I used MC_Spuds instead of Temporaldegrain:

http://rapidshare.com/files/153133911/itness_clip2.avi

The shape of the pyramid gets distorted and changes from one frame to the next. As you say, "garbage in, garbage out". If you think of any other ways to reduce the distortion, please let me know. Cheers.