PDA

View Full Version : Help with stutter! (long)


Roscoe62
18th August 2005, 09:54
For a while now I've been converting all my TV episodes on DVD to XVids.

Almost all of the episodes are in PAL format and are 4x3 non-interlaced. Initially I made avi files but lately I've converted over to using matroska files as they support chapter stops which I really need.

During motion scenes in my xvids I've noticed a slight stutter which is definitely more noticeable in some episodes and undetectable in others, but I'm convinced it's more to do with the type and quantity of motion onscreen that determines whether it's noticeable or not. I get stutters in both the avi and matroska files.

I very much enjoy the compression and overall picture quality I get with using XVid, but some of these episodes are painful to watch as the stutter is SO BAD! I'm sure it's to do with a setting or two that I have wrong, and I'm confident the experts in this group can set me straight.

I'm not sure exactly what details you need from me so I'll break down what my method is and what tools/versions I use, include my Avisynth script and XVid settings. I have also just finished encoding an episode of Star Trek : The Next Generation which exhibits a particularly nasty example of the stutter, but I've no idea how to break down the clip so I could post a sample for you to look at. Maybe, if it would be helpful, someone could tell me how to do this?

Anyway - on with it!

I rip the whole DVD disc which usually has about 4 episodes to HDD using DVD Decrypter v3.5.4.0

Then I fire up Robot4Rip v0.5. I use vStrip to grab the title I want, DGIndex v1.4.0b4 to do the index/demux, ChapterXtractor v0.962 and BeSweet to rip audio and convert to vbr mp3.

If I'm doing an episode of a show I haven't done before I will fire up Gordian Knot and go through the process to determine the best crop and size details to use and it will produce an avs file. I'll use this file as the basis for the rest of the series. Then I'll add in a few extra lines to enable using pixiedust which I like the look of. I then run Enc to determine compressibility. Finally I fire up VDubMod v1.5.10.1 build 2439 and load the avs script into it.

The only filter I add here is VDubMod's brightness filter as I find the XVid's I produce a bit too dark. I will run 2 passes of XVid to produce the Matroska file. I'm currently using XVid 1.0.3(?) - I haven't tried 1.1 yet. The source I'm using for this, again, is PAL 4:3 non-interlaced. Also, because they are TV episodes often the quality is not really that great to start off with. I just know that when playing back the DVD there is NO stutter.

AviSynth Script

# PLUGINS
LoadPlugin("C:\PROGRA~1\GordianKnot\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\TomsMoComp.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\DustV5.dll")
# SOURCE
mpeg2source("F:\XVid\B\A.d2v")
ConvertToYUY2().PixieDust(limit=2)
# TRIM
# IVTC
# DEINTERLACING (1)
TomsMoComp(1,5,1)
# DEINTERLACING (2)
# CROPPING
crop(14,0,696,572)
# SUBTITLES
# RESIZING
LanczosResize(576,432)
# DENOISING: choose one combination (or none)
Undot()
# BORDERS
# COMPRESSIBILITY CHECK
# FOOL CCEnc


XVid Settings

Profile AS@L5
Quant type - Custom ( I use Sharktooth's EQMV3LR)
Adaptive Quant
QPel
GMC
B-VOPs
Max Consecutive B-VOPs 2
Quant ratio : 1.50
Quant offset: 1.00
Closed GOV

Intra-frames tuning/Overflow/Curve - I don't think I've touched this at all - default

Advanced Options
Motion search precision : 6 - Ultra High
VHQ mode : 1 mode-decision
Use Chroma Motion
Frame drop ratio : 0
Max I-frame interval : 250
Quantization : Probably default (1,31,1,31,1,31)

I'm currently using Zoomplayer v4.03 to play back. I'm not sure how to retrieve my playback settings but if you think this could be an issue I could report them here.

I know there's a ton of information here, and there still may not be enough to determine where I'm going wrong, but I'd sure appreciate some help from a seasoned pro.

I have searched the forums for answers to this but haven't been able to find anything that matches this problem - and also I think I've reached as far as my current knowledge will take me. I really need help to sort this one out.

Can anyone help? :(

jon.schaffer
18th August 2005, 10:33
I would first take a look at the playback side...
A jerky playback is often present when the screen refrzsh rate is not a multiple of the frame rate.
In order to have a fluid playback, change you refresh rate to 75 Hz or 100 Hz (PAL is 25 fps, ie 75/3 or 100/4).
But, the sound sample rate can be involved in de-synchronization issues. Then I would advise you to take a look at ReClock, a software that 'transparently' synchronize all that.

communist
18th August 2005, 11:08
Almost all of the episodes are in PAL format and are 4x3 non-interlaced.

I have also just finished encoding an episode of Star Trek : The Next Generation which exhibits a particularly nasty example of the stutter, but I've no idea how to break down the clip so I could post a sample for you to look at.
The source I'm using for this, again, is PAL 4:3 non-interlaced.

# DEINTERLACING (1)
TomsMoComp(1,5,1)


Dont apply a deinterlacer if your source is not interlaced.

Harley Quin
18th August 2005, 15:51
Hi,

converting the PAL-Version of the X-Files I experienced a strange jerkiness as well, seemingly at random at motion scenes. Some have it, some don't. Looking at it frame by frame (Zoom Player: pressing "a" repeatedly) it looks like the shadow of a moving object is one frame ahead and the object is catching on at the next frame.
I found this interesting post from Sapient (http://forum.doom9.org/showthread.php?p=261921#post261921) who wrote:
"I am trying to encode some tv episodes (PAL DVD versions of Star Trek TNG and The X-Files.)
The original material is in NTSC, half of it true interlaced (the cg parts) and half telecined from 24fps. This source was transformed into interlaced PAL for europe using a truly stupid way (...). The result is an interlaced PAL stream that contains progressive parts, telecined parts, true interlaced parts and some pre-blended fields."
For the PAL version of the X-Files this seems to be exactly what I am dealing with here and as he explicitely mentions TNG it might be true for your material as well.
My source is interlaced, DGindex tells me so, and when I feed this .avs into VirtualDubMod I see combing effects at motion scenes:
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
mpeg2source("E:\path\file.d2v", idct=0)
Levels(0,1.5,255,0,255,true)
#you can skip the last line, the source is just terribly dark on my monitor
It is also to see, that this kind of "catching the shadow" is already in the source! I tried various InverseTelecine and Deinterlacing methods but could not get rid of it except at the cost of very smeary motion blur and I don't like that.

So my experience is:
FieldDeinterlace(blend=true) gives smooth motion but heavy motion blur.
Telecide(order=1,post=0,guide=2) produces quite a sharp image at the cost of very nasty choppiness every once in a while. The effect of catching the shadow seems to be enhanced to a real frame doubling. I wasn't happy with post=2 or post=4 either.
GreedyHMA(1,0,1,0,1,0,0,0) has more blending but is occasionally choppy as well. (1,0,0,0,0,0,0,0) is even more jerky.
I tried Tdeint, Kernel and Toms deinterlacers but they are choppy as well.

Far from "good", but closest to the source is a simple
FieldDeinterlace(blend=false). It has only some motion blur and the jerkiness is at least not much worse than the source...

So it might be worth a try to apply a script like
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\Undot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\FluxSmooth.dll")
mpeg2source("E:\path\file.d2v", idct=0)
FieldDeinterlace(blend=false)
crop(14,4,692,568)
Undot()
FluxSmoothST(7,7)
BicubicResize(448,336,0,0.5)
Levels(0,1.3,255,0,255,true)
and to compare it with the source.
See cropping, denoising and resizing only as examples, it's what suits me. But I recommend to deinterlace or InverseTelecine before you script anything else.

At some scenes Telecide(order=1,post=0,guide=2) seems to be way better than FieldDeinterlace, sharp (no motion blur) and smooth motion. But finding out manually when to apply which filter is lots of work. FieldDeinterlace in my eyes gives the overall better result.

You might try FieldDeinterlace(blend=false,full=false). I can't remember anymore whether it was better at the non-interlaced parts, at some point I simply got bored testing...

If you try GreedyHMA be sure to convert the colourspace as this filter only works in YUY2:
ConvertToYUY2()
GreedyHMA(1,0,1,0,1,0,0,0)
# and perhaps back
ConvertToYV12()

In my case all was a matter of filtering, XVid and it's options did have nothing to do with it. I tried interlaced encoding, though, but that was not of use for me as I want to downsize the frame.

I hope some of this might be for your assistance.
Greetings

Didée
18th August 2005, 16:05
Type "fieldblended" plus "film" into the board's search engine, and get excited ...

Roscoe62
18th August 2005, 22:56
Thank you all for replying.

I don't think it's any great surprise to see I'm a complete novice with this stuff and I've only dabbled a little in modifying avs scripts.

Didee, I did what you suggested and discovered those couple of threads about Restore 24 - I'm guessing that's what you meant for me to find? It DOES sound very promising! I'm going to have to do some serious reading this weekend and try to cobble together a script based on what I've listed but with the Restore 24 stuff added in (and taking priority where required). Hopefully it won't take me too long to get something working. If Restore 24 works as well as I hope it will, it'll be time well spent.

I'll report back. Thanks again for the heads up!

Roscoe62
19th August 2005, 12:30
AAargh!!!

I wish I knew my way around VDubMod and Avisynth better! When I try to load my script modified with the Restore24 lines it keeps falling over with an error - Avisynth open failure: LoadPlugin: unable to load "C:\Progra~1\Avisynth\plugins\masktools.dll" (F:\XVid\B\Next Generation Season 1 R24.avs, line 5)

Here is my modified script:

#setmemorymax(682)
# Load the needed functions
import("C:\PROGRA~1\Restore2\restore24.avs")
# PLUGINS
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\masktools.dll")
LoadPlugin("C:\PROGRA~1\Restore2\plugins\TDeint.dll")
LoadPlugin("C:\PROGRA~1\Restore2\plugins\LeakKernelDeint.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\UnDot.dll")
#LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\TomsMoComp.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\DustV5.dll")

LoadPlugin("C:\PROGRA~1\Restore2\plugins\avisynth_c.dll")
LoadcPlugin("C:\PROGRA~1\Restore2\plugins\SmartDecimate.dll")
LoadcPlugin("C:\PROGRA~1\Restore2\plugins\IBob.dll")

# SOURCE
mpeg2source("F:\XVid\B\A.d2v",cpu=4,iPP=true)

a2=r24kernelbob(0)
b2=TDeint(mode=1,tryweave=false)

restore24(a2, b2)

ConvertToYUY2().PixieDust(limit=2)

# CROPPING
crop(12,0,696,572)

# SUBTITLES
#VobSub("FileName")

# RESIZING
LanczosResize(640,480)

# DENOISING: choose one combination (or none)
Undot()

The full pathnames are all correct, so I don't know what I'm doing wrong!

Any thoughts? :(

scharfis_brain
19th August 2005, 12:47
Those kinds of NTSC -> PAL transfers are Evil to deinterlace.

I have a script, that is able to handle 90% of the jerky stuff, but fails miserably on the remaining 10% :(

Didée
19th August 2005, 13:15
Uh, this goes far away from XviD being the topic :|

I brought up the hint on fieldblending only because you were so sure that your sources are progressive, but then you mentioned TNG almost in the next breath. It is important that you know what kind of source you're actually dealing with, and then treat it accordingly!

Also, R24 is not a magic solution, but designed exclusively for fieldblended sources (e.g. like TNG aired in PAL land). If it is used on progressive or interlaced-without-fieldblending sources, it will mess these up completely.
Lately, there is MOmonster's alternative CRestore (http://forum.doom9.org/showthread.php?t=95924), which probably is easier to use and runs faster than R24. (Unless I bring out the new version, that is :D ) Crestore seems to work pretty good so far, it's really worth a try.

Regarding "unable to load ...\masktools.dll" ... are you on a P4 with HT? If so, try MaskToolsv1.5.8 (http://manao4.free.fr/MaskTools-v1.5.8.zip) instead. Some former versions have problems with hyperthreading CPUs.


Lastly, there seem to be several things in the AviSynth scripts created by Robot4Rip that are not good.

First off, better change the order of the LoadPlugin's like
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\masktools.dll")
LoadPlugin("C:\PROGRA~1\Restore2\plugins\TDeint.dll")
LoadPlugin("C:\PROGRA~1\Restore2\plugins\LeakKernelDeint.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\UnDot.dll")
#LoadPlugin("C:\PROGRA~1\GordianKnot\AviSynthPlugins\TomsMoComp.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\DustV5.dll")

LoadPlugin("C:\PROGRA~1\Restore2\plugins\avisynth_c.dll")
LoadcPlugin("C:\PROGRA~1\Restore2\plugins\SmartDecimate.dll")
LoadcPlugin("C:\PROGRA~1\Restore2\plugins\IBob.dll")

LoadPlugin("C:\PROGRA~1\Avisynth\plugins\LoadPluginEx.dll")
LoadPlugin("C:\PROGRA~1\Avisynth\plugins\DustV5.dll")
since this is more safe. It depends on which version of LoadPluginEx is used - some allow loading of AS-2.5 plugins after AS-2.0 plugins have been loaded, some allow not. Loading 2.0 plugins last is always safe.

Then, R24 might not run stable with recent 2.5.6 alpha version of AviSynth (unknown inconsistency with SmartDecimate). And worse, any further processing after calling R24 (here: PixieDust & the rest) may become dangerous (unknown inconsistency with either SmartDecimate or perhaps AviSynth's Conditional environment in general). One reason more to try Crestore first.

And, regarding your initial script (1st post):

- if the source is progressive, then no deinterlacer should be used.
- in case of an interlaced source, PixieDust must be used *after* the deinterlacer, and not before. Does Robot4Rip really produce such silly stuff? (I never used it, can't tell).


Last note, to have said at least a little bit about XviD: ;)

- Give a try on not using GMC, but (perhaps) increase VHQ from "1" to "2", or even more. GMC is very computational intensive, also when playing back the result - it is not impossible that GMC is part of the problem when you get choppy playback.

Roscoe62
19th August 2005, 13:44
:goodpost:

Wow! TONS of stuff here to try out. Thank you for giving me so much to think about! I will report back, but it's going to take a while!

First I will confirm whether the file is progressive or interlaced. (I'm pretty sure but I'll check again).

Thanks again for all your help! :)

EDIT: Hmmm just tested the episode in question in DGIndex and it is indeed INTERLACED.

Also, Yes I am running on a P4 with Hyperthreading. I'll give the updated Masktools a try.

EDIT2: Yup, using the updated Masktools sorted that issue out, but now I'm getting a script error : there is no function named "YV12layer" referring to line 45 of the Restore24.avs file.

I'm guessing this is referring to something I need to do that I'm not currently doing earlier in the process? Either that, or the YV12layer function works differently in the updated version of the MaskTools. In the meantime I will give some of the other things a try...

Didée
19th August 2005, 15:13
but now I'm getting a script error : there is no function named "YV12layer" referring to line 45 of the Restore24.avs file.

I'm guessing this is referring to something I need to do that I'm not currently doing earlier in the process?
*gnaaargh*

No, that's not your fault, but mine. (And a tiny li'l bit of Manao, too ;) ) - When R24 was created, MaskTools contained a command "YV12Layer", but it has disappeared somewhere between the version revisions. And R24 wasn't officially updated in the meantime ... with luck, I'll get it baken this weekend. Or not. Am still in bad shape, and can't do a fraction of what I want. :(

Workaround for the YV12Layer problem: here (http://forum.doom9.org/showthread.php?p=592900#post592900).

However, compaired to that old version of R24, I suspect Crestore already does a better job.
Oh, and in the special case of TNG, a "perfect" result is not possible, due to some of the production technics they used.

scharfis_brain
19th August 2005, 15:52
take a look at this:
http://forum.doom9.org/showpost.php?p=700966&postcount=15

(crappy, stupid, introduces some jerks where none were previously...)
I don't even know exactly what I did there, but it works for the most scenes..

Usage:

mpeg2source("tng.d2v")
repair_PAL_TNG_DVD()

needed plugins:
- leakkerneldeint
- masktools
- decomb

Roscoe62
20th August 2005, 04:49
scharfis_brain,

I read all of that thread. I didn't realise STTNG was so poorly xfrd to DVD!

I also took note of your script and would like to give it a go. However, I'm not real clear on the usage (being a bit of a newbie). Could you spell it out a little more? How could I incorporate it into a script? Would I run yours prior to doing an XVid encode? or at the same time?

Sorry for stupid question!