Log in

View Full Version : MW2 TempGaussMC Deinterlacing Script


spooky655
26th July 2010, 15:25
I have been trying out different bits and pieces of scripts to find what will give me the best results for deinterlacing and resizing (to 1280x720) Modern Warfare 2 gameplay that I can capture at 480i with composite cables.

So far, I am fairly satisfied (an example can be seen here: http://www.youtube.com/watch?v=ERgGB-r-9G4), but I think I might be able to do better. There is some motion blur and the quality could be a little better (youtube does blur it a bit though).

Here is the script I am currently using:

AVISource("C:\Users\test\Videos\captured\uncompressed\test_quarry.avi")

ConvertToYV12(interlaced=true)

SetMTmode(2,0)

Import("C:\Users\test\Downloads\videoCaptureAndDeinterlace\TempGaussMC_beta2.avsi")

AssumeBFF()

source = last
denoised = source.fft3dfilter(sigma=3,Sharpen=0.6,interlaced=true)
denoised_D = mt_makediff(source,denoised,U=3,V=3)

denoised.TempGaussMC_beta2(EdiMode="NNEDI2") .mt_adddiff(denoised_D.doubleweave(),U=3,V=3)

crop(8,2,-8,-2)

lanczos4resize(1280,720)

TDecimate(Mode=2,Rate=29.97)

I'm not sure how much a difference TDecimate makes over SelectEven, but I have been trying it and it seems to work okay.


Does anyone have suggestions for how I could make the gameplay look better? Mostly I just would like less motion blurring.

spooky655
26th July 2010, 21:43
I have now tried adding LimitedSharpenFaster() to the script, and it's noticeably sharpening the video (it's very apparent when watching the avi) and doesn't add to much processing time.

AVISource("C:\Users\test\Videos\captured\uncompressed\test_quarry.avi")

ConvertToYV12(interlaced=true)

SetMTmode(2,0)

Import("C:\Users\test\Downloads\videoCaptureAndDeinterlace\TempGaussMC_beta2.avsi")

Import("C:\Users\test\Downloads\videoCaptureAndDeinterlace\limitedsharpen.avs")

AssumeBFF()

source = last
denoised = source.fft3dfilter(sigma=3,Sharpen=0.6,interlaced=true)
denoised_D = mt_makediff(source,denoised,U=3,V=3)

denoised.TempGaussMC_beta2(EdiMode="NNEDI2") .mt_adddiff(denoised_D.doubleweave(),U=3,V=3)

crop(8,2,-8,-2)

LimitedSharpenFaster(ss_x=1.2,ss_y=1.2,Smode=3,strength=70)

lanczos4resize(1280,720)

TDecimate(Mode=2,Rate=29.97)


Here's the new video: http://www.youtube.com/watch?v=F5oor1GfhmM


So now the quality of still parts of the video is pretty good, but motion still isn't great (most noticeable from 00:48 - 00:52 in the video). Any suggestions for additions to script or a reordering of things?

spooky655
27th July 2010, 04:22
To clear things up, I think what I have been referring to as "motion blur" (I may be wrong) is actually blur caused by the lack of similar nearby frames during motion (frames that TempGaussMC uses to improve picture quality).

Also, I originally used these lines to avoid motion blur (actual motion blur):

source = last
denoised = source.fft3dfilter(sigma=3,Sharpen=0.6,interlaced=true)
denoised_D = mt_makediff(source,denoised,U=3,V=3)

denoised.TempGaussMC_beta2(EdiMode="NNEDI2") .mt_adddiff(denoised_D.doubleweave(),U=3,V=3)


Without using LimitedSharpenFaster(), this seemed to give better quality, as well as reduce motion blurring, so I have stuck with it. However, I am now seeing that, with the sharpening, just using "TempGaussMC_beta2(EdiMode="NNEDI2")" might be better. I am testing it now to see what gives better quality and the least motion blur, if any exists at all.


UPDATE: The quality after using "TempGaussMC_beta2(EdiMode="NNEDI2")" (see video here: http://www.youtube.com/watch?v=qapMDTpRPEs), and does seem to have a little more motion blur (actual motion blur). I think I'll stick with the alternative.

henryho_hk
27th July 2010, 15:55
Why don't you use TempGaussMC's sharpening parameters?

spooky655
27th July 2010, 16:14
Will that give as good results as FFT3DFilter and LimitedSharpenFaster? Could you give me an example of how to incorporate its sharpening parameters into my script?



For anyone who doesn't mind the massive download, here's an uncompressed avi of the first 30 seconds of the videos: http://www.nakido.com/DB4F5F10C91C8AD22FBBAAC7A11AE36A38511BE4

henryho_hk
28th July 2010, 17:34
avisource("test_quarry.avi")

assumetff()
converttoyv12(interlaced=true)
degrainmedian(mode=2,interlaced=true)
crop(8,0,704,480)

TempGaussMC_beta2(tr2=3,sharpness=1.7,Sbb=2,SLrad=2,SVthin=0.75,Sovs=2,EdiMode="NNEDI2").selecteven()

nnedi2_rpow2(rfactor=2,cshift="spline64resize",fwidth=1280,fheight=720)

spooky655
28th July 2010, 19:04
Thanks for the reply! I have been trying the script out and it seems to give a much smoother result. The downside is that it is slower (using huffyuv lossless compression, about 0.9fps instead of 1.3fps), but I'll see how it turns out on youtube to see if it's worth it.

UPDATE: Here is the result from your script: http://www.youtube.com/watch?v=PiZ8tlJMXqU. It does look smoother :)

I have a few questions:

Is there any reason you used spline64resize over lanczos4resize?

The video is bottom field first. Did you mean assumebff()?

Does it matter if assumebff() goes before or after converttoyv12(interlaced=true)?

henryho_hk
29th July 2010, 00:54
AVISource() always reports BFF. We need to check the output of "assumetff().separatefields()" and "assumebff().separatefields()" to confirm the actual field order. And I usually put assumetff/bff() right after AVISource().

The speed reduction is mostly caused by "nnedi2_rpow2()". It enlarges the images in a smarter way to make it better looking.

Also, since your source is CG, there should be no grain to begin with. I do not think you need use TempGaussMC in a noise-preserving manner.

spooky655
29th July 2010, 01:17
If assumebff().separatefields() gives me a jumpy video, does that mean my video is tff? Have I been assuming the wrong field order all along ("Info()" told me it was bff)???

henryho_hk
29th July 2010, 06:48
Yes, AVISource is always saying BFF because it does not know the correct field order either. That seems to be a limitation of the VFW interface or the AVI container.

And when the separated fields appear jumpy, their temporal order is incorrect, i.e., the field order is wrong.

aegisofrime
29th July 2010, 08:03
AVISource() always reports BFF. We need to check the output of "assumetff().separatefields()" and "assumebff().separatefields()" to confirm the actual field order. And I usually put assumetff/bff() right after AVISource().

The speed reduction is mostly caused by "nnedi2_rpow2()". It enlarges the images in a smarter way to make it better looking.

Also, since your source is CG, there should be no grain to begin with. I do not think you need use TempGaussMC in a noise-preserving manner.

I'm probably being pedantic here, but some games do add grain for atmosphere. Left 4 Dead 1 & 2 comes to mind, as do some levels of Modern Warfare 1 & 2.

henryho_hk
29th July 2010, 15:44
But then I suppose we should use one of those "Grain Optimizers"

spooky655
29th July 2010, 16:02
Well, I'm not sure I need it. I am really impressed by this quality: http://www.youtube.com/watch?v=fB2c5Jhd9Pk :) So, unless there's a way of improving quality without decreasing speed, or increasing speed without hurting quality, I am satisfied.

For anyone who wants to use the script in the future, here is the full script:

AVISource("test_terminalonline.avi")

SetMTmode(2,0)

AssumeTFF()

Import("TempGaussMC_beta2.avsi")

ConvertToYV12(interlaced=true)

degrainmedian(mode=2,interlaced=true)

crop(8,0,704,480)

TempGaussMC_beta2(tr2=3,sharpness=1.7,Sbb=2,SLrad=2,SVthin=0.75,Sovs=2,EdiMode="NNEDI2").selecteven()

nnedi2_rpow2(rfactor=2,cshift="spline64resize",fwidth=1280,fheight=720)