View Full Version : Deinterlacing Fieldblended NTSC
~Revolution~
7th December 2009, 09:42
I cannot figure out how to deinterlace this source properly. :(
it seems to be a 24p -> fieldblended -> NTSC 29.97 or something like that. the fps I'm aiming for is 23.976 but I'm not sure how to approach doing it exactly.
Thanks in advance.
Sample: http://www.sendspace.com/file/aylp07
thetoof
7th December 2009, 09:52
safe bob with blends
deblend
as in
i=source
i.yadifmod(mode=1,edeint=i.nnedi2(-2))
srestore(frate=23.976)
haven't looked at your sample though, only based on your assumptions
~Revolution~
7th December 2009, 10:16
safe bob with blends
deblend
as in
i=source
i.yadifmod(mode=1,edeint=i.nnedi2(-2))
srestore(frate=23.976)
haven't looked at your sample though, only based on your assumptions
is there a way to speed up the processing speed because its going really slow :( other than that it seems to be working very well. No residual combing. Clean frames at 23.976. I did try Tdeint as the bobber as well and it left behind some combing. I think I will have to go by yadifmod and nnedi2 after seeing the high quality and clean output it has.
~Revolution~
7th December 2009, 10:23
But if the sample can be looked at then I would feel more comfortable putting this in the encoder :)
thetoof
7th December 2009, 10:47
speed up the processing = don't use nnedi2 and/or use a cheaper bobber. Can't really have both quality and speed.
If you have multi-core - split your clips in the number of cores you have
s=source.yadif.other processing
a=s.trim(0,x)
b=s.trim(etc etc
c
d
return a/b/c/d
Open avs in vdub with return a, save as lagarith lossless rendering pass, in the meantime do the same with the others so you have x processes running at the same time. CPU is used at 100%, max speed you can get.
Then, for final encode, avisource("a.avi")+avisource.......
and
actually, what you have is PAL fieldblended to NTSC.
So, you may have film -- speed-up to PAL -- fieldblend to NTSC
Check the duration of your movie, check if it matches the one in IMDB. If it's shorter, it means you have a speed up. A script to correct it would be:
i=audiodub(mpeg2source("clip.d2v"),nicac3source("file.ac3")) #yes, you will need to demux your ac3 audio via dgindex and import it in avs with nicaudio if you want to keep your original channels. If it's only 2.0, you can convert to wav.... but I prefer doing it all in avs
i.yadifmod(mode=1,edeint=i.nnedi2(-2))
srestore(frate=25) #or repal(), I've never used it but heard good things about it
# Inverse 4% speed up for PAL telecine:
Nfr_num = 24000 #or 24
Nfr_den = 1001 #or 1
Ar = Audiorate()
ResampleAudio(Ar*FramerateNumerator()*Nfr_den, FramerateDenominator()*Nfr_num)
AssumeSampleRate(Ar)
AssumeFPS(Nfr_num, Nfr_den, False)
Never had to use it before, but based on the docs and my little avs experience, it should do the trick
manono
7th December 2009, 11:00
It hasn't been field-blended from a film source, but from a PAL source to 29.97fps:
Yadif(Order=1,Mode=1)#or your favorite bobber
Repal()#or SRestore()
If you really want to make it 23.976fps then add AssumeFPS(23.976) to the script and also slow both the audio and subtitles.
thetoof
7th December 2009, 11:59
No rudeness intended, but I prefer using the wiki's slowdown as shown to keep the audio rate... and is your post there to correct something I wrote or you simply started writing it before I posted?
manono
7th December 2009, 12:22
No, I wasn't intending to correct anything you wrote. I didn't know you had posted until just before I posted myself, when I previewed it and saw you had posted as I was writing and checking out the video.
However, if someone's looking for a simpler script, it doesn't get much more simple than the one I posted. If someone wants a much faster script (remember, this is a very long movie here, and not a music video or something else short), then they
don't get much faster, with not much decline in output quality. He had already mentioned the slowness of your previous script.
As for slowing it down, I don't understand what you mean by keeping the audio rate (bitrate? sampling rate?), but I much prefer to reencode it separately, using BeSweet to make a 6 mono WAV files (or regular stereo WAV, depending) and then reencoding to AC3.
Edit: A little checking around shows it refers to the sampling rate. Since it's being kept at 48kHz, I don't see why my method wouldn't work, although audio isn't really my speciality. If I've done this once I've done it probably 500 times and haven't noticed any problems with the audio from slowing it to film speed. Does doing it through AviSynth also correct the high PAL pitch of the audio, or does it improperly keep the pitch the same?
thetoof
7th December 2009, 12:43
Good point.
Yes, I meant sampling rate.
Since we're talking about personal preferences, drag and dropping the avs into megui with no intermediate step/file to Aften AC3 (or anything else for that matter) at the same sampling rate as the source (or a user specified one in the avs) and no change in the channels would be my favourite.
edit:Edit: Does doing it through AviSynth also correct the high PAL pitch of the audio, or does it improperly keep the pitch the same?From what I recall, assumefps was not able to correct the pitch, but the wiki's method I copied was... then again it's been a while since I had to touch anything like it and I may have confused it with something else.
~Revolution~
7th December 2009, 16:03
I did a test run with:
i=source
i.yadifmod(mode=1,edeint=i.nnedi2(-2))
srestore(frate=23.976)
Sample encode of roughly the same area of the previous sample plus some extra filters were used for color correction and denoising: http://www.sendspace.com/file/ptxk6h
And the output had a couple of blended transitions and some very very minute stuttering. So based on what has been decided I have to bring the fps to 25 from srestore then to bring it back to film rate I do the section under "Inverse 4% speed up for PAL telecine"?
Also as a separate question to manono, if I were to use besweet in this process, what is the exact method to converting 6 ch ac3 audio to film rate audio like you hinted above ?
Thanks so much thetoof your explanation makes it easy for me to understand the inverse process to film rate. I think i will go by the method of lagarith encoding in segments then to join them back in the end. Also regarding Assumefps(), as you guys have talked about above, it does NOT fix the PAL speedup pitch or does it fix it but not fully? My main purpose to bring the source back to film rate was weirdly enough it seemed to me as if even at 25 fps the video was going much faster then other 25 fps PAL progressive material i had. Maybe its just the new actors talking fast or something but i can't really seem to figure it out. I just thought bringing it back to 24p would fix that speedup sort of feeling. Once again by comparison to other PAL progressive material i have at 25 fps this source seems to be somewhat extra speedy after bob-deinterlacing it with yadif and srestore(25) as I had done on another encode shortly after creating the sample mkv above.
thetoof
7th December 2009, 22:28
Yes, you will have to use frate=25 (or repal) and not frate=23.976, unless you want to drop good frames.
Then, you have 2 options: slow down your video and audio in avisynth as I showed (inverse 4% speed-up thingy) or do everything with the audio separately using besweet.
As I mentioned, the reason why I prefer to do it in avs is that you don't need any intermediate file. You simply drop the avs into megui and choose whatever audio codec you want to use since (if you have 5.1 audio) it'll be converted to 6-channel WAV internally.There is nothing such as "film rate" audio, it is simply slowing it down so that it is still in sync with your video.
Also, relying on how you "feel" about the source is... fine, but as I mentioned, comparing the lengths of your clip and the official one in IMDB will help you make a good decision.
~Revolution~
7th December 2009, 22:33
Yes, you will have to use frate=25 (or repal) and not frate=23.976, unless you want to drop good frames.
Then, you have 2 options: slow down your video and audio in avisynth as I showed (inverse 4% speed-up thingy) or do everything with the audio separately using besweet.
As I mentioned, the reason why I prefer to do it in avs is that you don't need any intermediate file. You simply drop the avs into megui and choose whatever audio codec you want to use since (if you have 5.1 audio) it'll be converted to 6-channel WAV internally.There is nothing such as "film rate" audio, it is simply slowing it down so that it is still in sync with your video.
Also, relying on how you "feel" about the source is... fine, but as I mentioned, comparing the lengths of your clip and the official one in IMDB will help you make a good decision.
the imdb one is about 6 mins longer.
thetoof
7th December 2009, 22:34
Then, slow it down.
EuropeanMan
7th December 2009, 22:37
the imdb one is about 6 mins longer.
2 hours 9 = 129 minutes
2 hours 15 (from imdb as you claim) = 135 minutes
135 * .04 = 5.4 mins
135 - 5.4 = 129.6 minutes
~Revolution~
7th December 2009, 22:45
Then, slow it down.
The problem is that I still see ghosting and blended frames after all of this :( I think there is something weird about the frame pattern in the source. Seriously its freaking me out. it doesnt seem like a straight PAL speedup -> fieldblended -> NTSC source. I think the framerate was indeed 23.976 at some point but got very badly messed up in the conversion process to NTSC 29.97. Once again im not positive but just wanted to point that out.
You can see frame blending in the transition of these three images:
1: http://img340.imageshack.us/img340/9648/77748673.png
2: http://img265.imageshack.us/img265/7229/77815450.png
3: http://img27.imageshack.us/img27/4444/52764755.png
thetoof
7th December 2009, 22:49
I get a 403 on the first image and as for the others... no blending...? Sure, it's very smooth, but it shouldn't be very noticeable while watching the movie.
edit: oh, never mind, I can see the image now... Yeah, this happens every now and then... do you have a video sample with one of these "blends"?
EuropeanMan
7th December 2009, 22:52
There is NO WEIRD FRAMING on that movie. NONE - WHATSOEVER. It's a simple bob/deinterlace to 25fps. SIMPLE ENOUGH. NO blends or ghosting.
~Revolution~
7th December 2009, 22:55
I made a mistake in the duration of the video it is actually 2:09:00 without deinterlacing filters in the script *duh* I should have looked at that before seeing the length. Just to be technical the duration in imdb is 140 mins so 2 hr 20 min the time of the source is 2:08:59 ~2:09:00. A difference of 11 mins.
EuropeanMan
7th December 2009, 23:01
Imdb is wrong in this instance.
~Revolution~
7th December 2009, 23:02
I get a 403 on the first image and as for the others... no blending...? Sure, it's very smooth, but it shouldn't be very noticeable while watching the movie.
edit: oh, never mind, I can see the image now... Yeah, this happens every now and then... do you have a video sample with one of these "blends"?
http://www.sendspace.com/file/knnbps
EuropeanMan
7th December 2009, 23:06
@ thetoof, I have this same DVD9. It's a simple bob/deinterlace to 25. That's it. This user JUST WANTS TO PROVE TO THE WORLD that he can rip the DVD9 to 23.976. That's the ONLY reason. For an extremely STUPID MOVIE, it's not worth it to try to get back to FILM RATE. It's idiotic in my opinion. He won't be saving his encode for future generations. It's a 'release' he's worried about.
manono
8th December 2009, 02:48
The problem is that I still see ghosting and blended frames after all of this :( I think there is something weird about the frame pattern in the source. Seriously its freaking me out. it doesnt seem like a straight PAL speedup -> fieldblended -> NTSC source. I think the framerate was indeed 23.976 at some point but got very badly messed up in the conversion process to NTSC 29.97.
You're wrong. It's an ordinary PAL2NTSC field-blended conversion. Your pics don't show any ghosting at all - edge enhancement, yes, but no residual ghosting.
EuropeanMan, not everyone is happy with PAL speedup. In my own case I regularly slow them back to 23.976fps and fix the off-pitch audio. Since music is an important part of these films, it makes perfect sense to me.
I understand that eac3to can do the slowdown and reencoding quite easily, but as I haven't used it yet myself I can't provide instructions. I believe it works with 25fps to 23.976, so your video had best be 25fps to begin with, I think. Use SRestore at default settings, rather than RePAL, before adding in AssumeFPS(23.976).
http://forum.doom9.org/showthread.php?t=125966
Also as a separate question to manono, if I were to use besweet in this process, what is the exact method to converting 6 ch ac3 audio to film rate audio like you hinted above ?
thetoof
8th December 2009, 03:25
Actually, there is a "something" that remains at scene changes, not really sure what it is though... Looks like blue chroma from the previous frame leaks to the next during scene changes, but that may just be my eyes. I mean, something is leaking, but it may not be chroma-only related.
The rest is as manono pointed out (your stream definitely being 25fps and all that)
edit: oh and EuropeanMan, sure the framerate is 25fps after the simple bob/deblend, but the original framerate of the film, not the video, is 24fps, which can (and should imo, in part for the reasons manono mentioned) be restored by slowing down the clip.
~Revolution~
8th December 2009, 03:34
Actually, there is a "something" that remains at scene changes, not really sure what it is though... Looks like blue chroma from the previous frame leaks to the next during scene changes, but that may just be my eyes. I mean, something is leaking, but it may not be chroma-only related.
The rest is as manono pointed out (your stream definitely being 25fps and all that)
edit: oh and EuropeanMan, sure the framerate is 25fps after the simple bob/deblend, but the original framerate of the film, not the video, is 24fps, which can (and should imo, in part for the reasons manono mentioned) be restored by slowing down the clip.
Yeah there is some leakage on transitions. Its almost like extraneous frames or dupe frames remain after bobbing it.
@ manono thanks for the explanation. Very easy to follow and will experiment with it today :)
manono
8th December 2009, 03:48
Yeah there is some leakage on transitions. Its almost like extraneous frames or dupe frames remain after bobbing it.
It's common with that field-blended garbage. And the unblenders won't remove it. About all you can do is work your way through the movie and use FreezeFrame on them to replace the bad frames with good frames just before or after. Since they're on scene changes no one will notice the slight introduced stutter.
~Revolution~
8th December 2009, 04:31
It's common with that field-blended garbage. And the unblenders won't remove it. About all you can do is work your way through the movie and use FreezeFrame on them to replace the bad frames with good frames just before or after. Since they're on scene changes no one will notice the slight introduced stutter.
ok :)
~Revolution~
8th December 2009, 07:05
I think some parameters of yadifmod or srestore need to be tweaked in order to make for a smoother playback and no transition stutters. I'm positive something can be done about it if the filters are broken down into their component parts and tweaked appropriately.
~Revolution~
8th December 2009, 18:52
I think some parameters of yadifmod or srestore need to be tweaked in order to make for a smoother playback and no transition stutters. I'm positive something can be done about it if the filters are broken down into their component parts and tweaked appropriately.
Ok so veering off the deinterlacement topic (which I think I've pretty much fixed), why is there edge enhancement in my output? I guess i don't fully understand the reason behind edge enhancement.
thetoof
8th December 2009, 19:01
The type of "blend" you have is extremely hard to detect... good luck with that.
However there's a function that allows you to automatically replace frames at scene changes; I think it's this one:
function SCC (clip source, float "dfactor"){
dfactor=default(dfactor,2.0)
prev = source.selectevery(1,-1)
next = source.selectevery(1,1)
return source.SCSelect(next,prev,source,dfactor=dfactor)
}
#dfactor = 1.0 ~ 5.0
What you need is a dehaloing function... plenty out there: dehalo_alpha (good and easy to tweak), YAHR (no tweaking required and you can chain multiple calls)... and I've never used the others (blinddehalo, etc etc)
function DeHalo_alpha(clip clp, float "rx", float "ry", float "darkstr", float "brightstr", float "lowsens", float "highsens", float "ss")
{
rx = default( rx, 2.0 ) #horizontal radius
ry = default( ry, 2.0 ) #vertical radius
darkstr = default( darkstr, 1.0 ) #strength on dark halos/lines
brightstr = default( brightstr, 1.0 ) #strength on bright halos/lines
lowsens = default( lowsens, 50 )
highsens = default( highsens, 50 )
ss = default( ss, 1.5 ) #supersampling
LOS = string(lowsens)
HIS = string(highsens/100.0)
DRK = string(darkstr)
BRT = string(brightstr)
ox = clp.width()
oy = clp.height()
uv = 1
uv2 = (uv==3) ? 3 : 2
halos = clp.bicubicresize(m4(ox/rx),m4(oy/ry)).bicubicresize(ox,oy,1,0)
are = mt_lutxy(clp.mt_expand(U=uv,V=uv),clp.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
ugly = mt_lutxy(halos.mt_expand(U=uv,V=uv),halos.mt_inpand(U=uv,V=uv),"x y -","x y -","x y -",U=uv,V=uv)
so = mt_lutxy( ugly, are, "y x - y 0.001 + / 255 * "+LOS+" - y 256 + 512 / "+HIS+" + *" )
lets = mt_merge(halos,clp,so,U=uv,V=uv)
remove = (ss==1.0) ? clp.repair(lets,1,0)
\ : clp.lanczosresize(m4(ox*ss),m4(oy*ss))
\ .mt_logic(lets.mt_expand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"min",U=uv2,V=uv2)
\ .mt_logic(lets.mt_inpand(U=uv,V=uv).bicubicresize(m4(ox*ss),m4(oy*ss)),"max",U=uv2,V=uv2)
\ .lanczosresize(ox,oy)
them = mt_lutxy(clp,remove,"x y < x x y - "+DRK+" * - x x y - "+BRT+" * - ?",U=2,V=2)
return( them )
}
function m4(float x) {return(x<16?16:int(round(x/4.0)*4))}
function YAHR(clip clp)
{
b1 = clp.minblur(2).removegrain(11,-1)
b1D = mt_makediff(clp,b1)
w1 = clp.aWarpSharp2(depth=32,blurlevel=2,thresh=0.5)
w1b1 = w1.minblur(2,1).removegrain(11,-1)
w1b1D = mt_makediff(w1,w1b1)
DD = b1D.repair(w1b1D,13)
DD2 = mt_makediff(b1D,DD)
clp.mt_makediff(DD2,U=2,V=2)
}
~Revolution~
10th December 2009, 23:48
I just did some encodes with yadifmod and nnedi2 and it doesn not have smooth pans at all. The transition "fading" thing is quite apparent and annoying too. I need some help to figure out the blend pattern and how to tackle it manually. Thanks.
~Revolution~
11th December 2009, 01:03
Also it would be nice if Didee and neuron2 could please help me on this problem as well. Its starting to drive me nuts.
manono
11th December 2009, 03:15
I need some help to figure out the blend pattern and how to tackle it manually.
It's probably blend patterns. Dozens, if not hundreds, of them. Manually, eh? There's scharfi's old UnblendPattern:
http://forum.doom9.org/showthread.php?s=&threadid=66093
and his more recent one (don't know the name):
xxxSource("yourvideo.xxx")
#load the video
assume?ff()
#set the fieldorder of the video
yadif(mode=1)
#bob-deinterlace to 60fps
changefps(250)
#prepare the manual deblending by setting 10 times the desired output framerate
selectevery(10, ?)
#replace ? by a number between 0...9 to find the correct offset for deblending.
Are you sure you got the field order correct? If you get it wrong the unblenders don't work well.
~Revolution~
11th December 2009, 03:54
Here is another sample with some pans and more movement than the other samples: http://www.sendspace.com/file/lg2nic
I'm not sure about the fieldorder but I assumed it was tff. Also how do I figure out the "correct" offset for the selectevery "?" part?
DGIndex Info:
http://img51.imageshack.us/img51/2489/28066792.png
manono
11th December 2009, 04:20
Also how do I figure out the "correct" offset for the selectevery "?" part?
You guess, starting with zero and working your way up to nine. And then when the pattern changes you start over again.
Didée
11th December 2009, 12:03
Good look with that pattern-offset deblending. Often enough it tends to turn into an overly huge effort.
Try the following. If that isn't good enough, I suggest to just forget about the movie. The possible improvement on fieldblended stuff is always limited, you'll never get those 100% that you would like. "crap in, crap out", y'know? Learn to be satisfied with somethig that's just "mostly OK".
mpeg2source("Cut2.d2v")
crop(0,56,-0,-56)
nedibob = nnedi2(field=-2)
prev = nedibob.selectevery(1,-1)
next = nedibob.selectevery(1,1)
max = nedibob.mt_logic(prev,"max",U=3,V=3).mt_logic(next,"max",U=3,V=3)
min = nedibob.mt_logic(prev,"min",U=3,V=3).mt_logic(next,"min",U=3,V=3)
calm = nedibob.merge(nedibob.clense(reduceflicker=false),0.5)
resharp = mt_clamp(calm.sharpen(1),max,min,0,0,U=3,V=3)
restore = resharp.SRestore(frate=25.000) # or calm.srestore(), or nedibob.srestore()
# freeze before+after scenechange. Needs v0.9 of RemoveDirt.dll
prev = restore.selectevery(1,-1)
next = restore.selectevery(1,1)
SCclean = restore.SCSelect(next,prev,restore,dfactor=2.0) # 2.0 ~ 5.0
# ... with or without scenechange cleaner ...
# restore
SCclean
return( last )
~Revolution~
11th December 2009, 17:33
I'm getting a "no function named cleanse" script error in AvsP.
Here's my basic script from start to finish:
## Load DLLs and External Scripts
loadplugin("F:\AVSPLUGINS\nnedi2.dll")
loadplugin("F:\AVSPLUGINS\masktools.dll")
loadplugin("F:\AVSPLUGINS\mt_masktools-26.dll")
loadplugin("F:\AVSPLUGINS\mvtools2.dll")
loadplugin("F:\AVSPLUGINS\RemoveGrainSSE3.dll")
loadplugin("F:\AVSPLUGINS\RepairSSE3.dll")
loadplugin("F:\AVSPLUGINS\RemoveDirtS.dll")
loadplugin("F:\AVSPLUGINS\RSharpenSSE3.dll")
import("F:\AVSPLUGINS\srestore.avsi")
import("F:\AVSPLUGINS\LSFmod.v1.9.avsi")
import("F:\AVSPLUGINS\YLevels_mt.avsi")
## Source
mpeg2source("F:\New\VTS_02_1.d2v",cpu=2, info=3)
##Deinterlace
nedibob = nnedi2(field=-2)
prev = nedibob.selectevery(1,-1)
next = nedibob.selectevery(1,1)
max = nedibob.mt_logic(prev,"max",U=3,V=3).mt_logic(next,"max",U=3,V=3)
min = nedibob.mt_logic(prev,"min",U=3,V=3).mt_logic(next,"min",U=3,V=3)
calm = nedibob.merge(nedibob.clense(reduceflicker=false),0.5)
resharp = mt_clamp(calm.sharpen(1),max,min,0,0,U=3,V=3)
restore = resharp.SRestore(frate=25.000) # or calm.srestore(), or nedibob.srestore()
# freeze before+after scenechange. Needs v0.9 of RemoveDirt.dll
prev = restore.selectevery(1,-1)
next = restore.selectevery(1,1)
SCclean = restore.SCSelect(next,prev,restore,dfactor=2.0) # 2.0 ~ 5.0
# ... with or without scenechange cleaner ...
# restore
SCclean
return( last )
## Crop
crop( 4, 58, -4, -58)
## Denoise and Sharpen
super = MSuper(pel=2, sharp=1)
backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=4, blksize=16,chroma=false)
backward_vec1 = super.MAnalyse(isb = true, delta = 1, overlap=4, blksize=16,chroma=false)
forward_vec1 = super.MAnalyse(isb = false, delta = 1, overlap=4, blksize=16,chroma=false)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=4, blksize=16,chroma=false)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=200)
LSFMod(defaults="slow")
##YLevels
YLevelsS(8, 1.0, 240, 0, 260)
## Resize
Spline64Resize(640,272)
Didée
11th December 2009, 17:45
Follow this note (http://forum.doom9.org/showthread.php?p=1337452#post1337452).
While we're at it, you should rather use mt_masktools-25.dll. (The ~25.dll is for Avisynth 2.5.x, the ~26.dll is for Avisynth 2.6.)
~Revolution~
11th December 2009, 18:35
I only have three letters to say. O M G. Didée you are simply a genius. Your script worked perfectly and I'm loading all the Removegrain dll's with SSE2 and mt-masktools-25. No crashes or anything. Perfect smooth motion. Perfect transitions. No interlacing left. Absolutely perfect. Thanks so much :D
I'm 100% completely satisfied and happy with the output now.
Also I just want to make sure that for future use, SSE3 is not a good choice for avisynth 2.5? I just wanted to be sure
Didée
11th December 2009, 19:50
In several versions of RemoveGrain, the SSE3 versions were buggy. AFAIK it has been fixed in the latest final version of RemoveGrain v1.0 ... but then, RG 1.0 final is not fully backwards compatible to earlier versions, so it will break on some scripts, hence I continue to use (and recommend) the earlier "pre-1" version of RemoveGrain v1.0.
(Culprit is "Clense" in first instance. Moreover, 1.0final comes with several new modes and doodads, but ... without any documentation. With the buckload of different modes, and possible changes from previous versions, the total absence of documentation is reason enough {for me} to not use it.)
On the brighter side, SSE2/SSE3 really is neglectable. If RemoveGrain(x) runs at hypothetical 800fps in SSE2 and hypothetical 810fps in SSE3, then the speed difference in practice is just zero. You really care if a 2-hours-encoding takes 10 seconds more or less? Me not. SSE2 is fast enough, period.
Gavino
11th December 2009, 22:17
While we're at it, you should rather use mt_masktools-25.dll. (The ~25.dll is for Avisynth 2.5.x, the ~26.dll is for Avisynth 2.6.)
I see this mistake a lot in posted scripts, and occasionally (if not too lazy) I point it out myself.
For future reference, can you say specifically what problems occur when using masktools-26 with Avisynth 2.5.x?
~Revolution~
11th December 2009, 22:58
Also Didée, if you don't mind, can you sort of explain/teach what is happening or the "flow chart" of the process in the code you supplied? I'm really curious as to how the script really functions internally :)
nedibob = nnedi2(field=-2)
prev = nedibob.selectevery(1,-1)
next = nedibob.selectevery(1,1)
max = nedibob.mt_logic(prev,"max",U=3,V=3).mt_logic(next,"max",U=3,V=3)
min = nedibob.mt_logic(prev,"min",U=3,V=3).mt_logic(next,"min",U=3,V=3)
calm = nedibob.merge(nedibob.clense(reduceflicker=false),0.5)
resharp = mt_clamp(calm.sharpen(1),max,min,0,0,U=3,V=3)
restore = resharp.SRestore(frate=25.000) # or calm.srestore(), or nedibob.srestore()
# freeze before+after scenechange. Needs v0.9 of RemoveDirt.dll
prev = restore.selectevery(1,-1)
next = restore.selectevery(1,1)
SCclean = restore.SCSelect(next,prev,restore,dfactor=2.0) # 2.0 ~ 5.0
# ... with or without scenechange cleaner ...
# restore
SCclean
return( last )
And going back to Gavino's comment, I would also like to know the working difference between how mt-masktools-25 fiunctions vs mt-masktools-26 under AviSynth 2.5.
Didée
11th December 2009, 23:23
Frankly, I don't know off hand. But I certainly do remember that in the past, users were reporting mysterious masktools failures, and when it revealed they were using the mt-26.dll and swapped for the mt-25.dll, everything worked as expected.
Also, it's a matter of principle ... it's a bad habit when users just blindly grab the one with the bigger number, "because bigger is better". The documentation clearly states that those two DLLs are dedicated for two different versions of Avisynth.
Didée
11th December 2009, 23:47
Uh, well ... Basically, one would just do
nnedi2()
SRestore()
One remaining problem is that there will be some "bob shimmer" in the result, because blend removers will use bob frames from both phases (i.e. from even and odd fields), and usually they will change phase more often than necessary.
Another (smaller) problem is that the bob shimmer from spatial interpolation ~might~ make the deblender's job a little harder. If bob shimmer is removed, there is less variance that might mislead the deblender.
The bob shimmer is removed by using 50% of a temporal median filter (clense). Note that this is NOT a generally-valid procedure: on clean interlaced input, it will create artifacts. However on fieldblended interlaced input, it will not. (Funnily, it's the blending in itself that will safeguard the median filtering.)
Downside of this calming is that it will also cut-down valid signal amplitude. To counteract this, the calmed bob is sharpened again, and the (now potentially over-sharpened) result is clamped to not exceed the pixel value in current/previous/next frame. (Because in either of these frames, the wished original pixel value is present.)
That's the "bob preparation" for feeding into SRestore.
~Revolution~
12th December 2009, 00:02
ah, I understand the overview of the process now. Thanks once again Didée :)
Gavino
12th December 2009, 00:59
The documentation clearly states that those two DLLs are dedicated for two different versions of Avisynth.
Maybe it could state it more clearly.
All I can see in mt_masktools.html is this entry buried in the changelog:
"Alpha 34 :
changed : both avisynth 2.5 and 2.6 version are built"
It is made clear in this post somewhere among the 270+ in the main Masktools thread.
But it's easy to see why newbies unaware of the nuances of Avisynth versions would assume that masktools-26.dll is more up-to-date.
~Revolution~
12th December 2009, 01:10
Maybe it could state it more clearly.
All I can see in mt_masktools.html is this entry buried in the changelog:
"Alpha 34 :
changed : both avisynth 2.5 and 2.6 version are built"
It is made clear in this post somewhere among the 270+ in the main Masktools thread.
But it's easy to see why newbies unaware of the nuances of Avisynth versions would assume that masktools-26.dll is more up-to-date.
yep, that's how I fell in the "trap" and started using 26. It didn't specifically say anywhere that it was for AviSynth 2.6 so I assumed it was an update to mt-masktools-25. But from now I'll use mt-masktools-25 :)
Didée
12th December 2009, 01:38
Mea culpa! I could've sworn that it's stated more clearly in the documentation - but you're right, it isn't. Guess it was that very post of Manao that burned-in my brain, and after some long time I thought I once had read it in the docu ... I fell for wishful thinking! Guilty!
~Revolution~
12th December 2009, 18:21
I've started having some weird issue again. It didn't happen before but basically when I leave the "return( last )" line in the script then it ignores everything after that line and all the changes I have done. I just wanted to make sure that was normal.
Didée
12th December 2009, 18:34
That's perfectly normal. Return(whatever) will end the Avisynth script, and deliver its argument to the hosting application. Put your additional code before the return statement ... or just delete the return line, it is not a must. (Hint: Basic knowledge of Avisynth's grammar is advantageous.;) )
~Revolution~
12th December 2009, 18:44
^Thanks :)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.