Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
22nd September 2016, 00:13 | #1 | Link |
Registered User
Join Date: Sep 2016
Posts: 67
|
A dummy needs some help porting an AviSynth script.
I'm trying to run this wonderful little IVTC script in VapourSynth:
Code:
edeintted = SeparateFields().SelectEven().EEDI2(field=-1) tdeintted = TDeint(edeint=edeintted) tfm(order=-1,clip2=tdeintted).tdecimate(mode=1,hybrid=1) So, I tried copying it to VapourSynth. This is what I got: Code:
f = 1 #top field first edeintted = core.eedi2.EEDI2(core.std.SelectEvery(core.std.SeparateFields(clip), 2, 0), field = f) tdeintted = core.tdm.TDeintMod(edeintted, order = f) clip = core.vivtc.VFM(edeintted, order=f,clip2=tdeintted) clip = core.vivtc.VDecimate(clip) I know VDecimate is missing some of the options TDecimate has, and VS doesnt have the internal field flag that AS has. The 2 plugins are attached. And please, forgive me, for I know not what I do EDIT: Oh, and here's a sample: Interlaced: https://drive.google.com/open?id=0B5...GthUDlRQk5mNlE Desired final output: https://drive.google.com/open?id=0B5...WdZVGNVQUFtNEE Last edited by brucethemoose; 22nd September 2016 at 00:51. |
22nd September 2016, 00:21 | #2 | Link |
Registered User
Join Date: Jun 2012
Location: Ibiza, Spain
Posts: 321
|
Code:
clip = core.vivtc.VFM(edeintted, order=f,clip2=tdeintted) Code:
clip = core.vivtc.VFM(clip, order=f,clip2=tdeintted) Anyway, I don't know if that's gonna fix anything. |
22nd September 2016, 00:45 | #3 | Link | |
Registered User
Join Date: Sep 2016
Posts: 67
|
Quote:
You got the right idea though, I think I followed the variables around wrong and misplaced one of the videos. |
|
22nd September 2016, 04:19 | #4 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
The clip2 parameter doesn't do what you think it does. In TFM it's used for postprocessing frames that are detected as interlaced after field matching, but VFM doesn't have any postprocessing functionality (instead it sets the _Combed frame property and lets you sort that stuff out yourself). Instead, clip2 is used if you want to use VFM on something that isn't 8-bit YV12, in which case matching decisions are made based on clip while output is created from clip2.
I would suggest consulting the documentation for VFM; it's not an exact copy of TFM. |
22nd September 2016, 04:32 | #5 | Link | |
Registered User
Join Date: Sep 2016
Posts: 67
|
Quote:
EDIT: Oh, but I did just see the _Combed property, I guess I can work with that, thanks. I do wish VS wouldn't crash when trying to import the script with Avisource though Last edited by brucethemoose; 22nd September 2016 at 04:35. |
|
22nd September 2016, 06:33 | #6 | Link |
Registered User
Join Date: Sep 2016
Posts: 67
|
What's the syntax for getting _Combed?
I'm brand new to python and pretty new to coding, and after digging though github and the forums I can't find a single simple example of anyone simply grabbing a property from the current frame. I've seen the documentation here: http://www.vapoursynth.com/doc/pythonreference.html But it doesn't tell me the syntax for accessing that property. Last edited by brucethemoose; 22nd September 2016 at 06:39. |
22nd September 2016, 07:45 | #7 | Link |
Registered User
Join Date: Sep 2016
Posts: 67
|
Alright, I seem to have figured it out. I didn't realize we needed a whole function for conditional statements, but it kinda makes sense.
If anyone in the future is looking for an Vapoursynth IVTC post-processor (something to get rid of the combed frames IVTC misses), this is what I got, basically copied from the TDeint example: Code:
f = 1 #field clip = core.vivtc.VFM(clip, mode = 0, order=f, mi = 74, cthresh = 8) #IVTC def conditionalDeint(n, f, orig, deint): if f.props._Combed: return deint else: return orig deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1)) #Deinterlacer goes here! #deint = havsfunc.QTGMC(clip, TFF=True, Preset="Medium", InputType=2 ) #Slower alternative, untested combProps = clip #Get _Combed flag from VFM #combProps = core.tdm.IsCombed(clip) #Get _Combed flag from IsCombed. clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), clip) clip = core.vivtc.VDecimate(clip) Last edited by brucethemoose; 22nd September 2016 at 17:15. |
22nd September 2016, 18:34 | #8 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
Code:
clip = core.vivtc.VFM(clip, mode = 0, order=1, mi = 74, cthresh = 8) deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1)) clip = core.std.FrameEval(clip, lambda n, f: return deint if f.props._Combed else clip, clip) you can write unreadable oneliners in any language, even python Last edited by TheFluff; 22nd September 2016 at 18:40. |
22nd September 2016, 21:11 | #9 | Link | |
Registered User
Join Date: Sep 2016
Posts: 67
|
Quote:
But I'm fine the sloppy def :P |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|