VideoHelp Forum
+ Reply to Thread
Results 1 to 17 of 17
Thread
  1. i moved to vapoursynth and i am having a hard time trying to figure out how to load and use plugins and filters .
    most conversions i find are not .dll files but .pyd or .py
    there were plugins that were saved with .avsi in vap...' is it .vpy? or .vpyi ? if i want to use it us a plugin ?
    how do i "install" the plugins i need assuming i know their name and where to download them, and how do i use them in the code?
    lets say in avspMod it was just "sharpen("x")" in vapoursynth its something else

    edit:figured out some stuff is in a "package" like "havsfunc" and "muvsfunc" and i have to load them "import muvsfunc as X"
    how do i use them when i import them as "x"?
    Last edited by zanzar; 8th Feb 2019 at 13:11.
    Quote Quote  
  2. You have to use their namespace . If you "import havsfunc as haf" , then "haf" is the namespace for the functions defined in havsfunc.vpy. Then you call the actual function . But you can use whatever namespace you want. I find it's easier to put the .vpy scripts into the python/Lib/site-packages folder . It would be analgous to the avisynth "plugins" folder with .avsi scripts, but you still have to use the import function to define the namespace .

    e.g for LSFMod

    Code:
    import vapoursynth as vs
    import havsfunc as haf
    core = vs.get_core()
    
    clip = core.lsmas.LWLibavSource(r'PATH\video.mkv')
    clip = haf.LSFmod(clip)
    clip.set_output()
    Quote Quote  
  3. Another way is to use avisynth directly in the vpy script . You can load an avs script in a vpy script with AVISource (limited to certain pixel formats). This can be useful when you're learning the syntax for vapoursynth, or the native plugin version or equivalent is slightly different (eg. VIVTC doesn't have all the functions of avisynth's TIVTC)

    Or the reverse - you can also load vpy script in avisynth (limited to certain pixel formats) with VapourSource

    For both of those - you need matching x64 or x86 versions installed of avisynth and vapoursynth; so those really work best only on Windows


    Other options are loading the avs plugin directly - you can load avs plugins through avs.LoadPlugin , or avsw.Eval (avsproxy) . But direct equivalents (native vapoursynth plugins and scripts) are usually faster. There is less overhead. Same with running avisynth host, and using VapourSource - native is almost always faster
    Quote Quote  
  4. Using Vapoursynth you directly write a script in Python language. You can name your script *.py , not necessarily *.vpy and it is going to work. Consoles (that you write in python) would not read vpy at first.

    Python import function is an equivalent to import *.avsi in Avisynth, except it is tons of more powerful because having Python going on you can import moduls of shear power to do almost anything because Python modul library is extremely large.

    in case of havsfunc.py, that is a legit Pyhon script and if you want to import it into your script , it is called importing modul havsfunc.

    Sometimes it is better to start with basics, for example, so your QTGMC script could be:
    Code:
    import vapoursynth
    import havsfunc
    file = r'C:\files\my_file.mp4'
    clip = vapoursynth.core.ffms2.Source(file)
    clip = vapoursynth.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = havsfunc.QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    but they like to shorten everything and loading those moduls in shorter ways so you could get:
    Code:
    from vapoursynth import core
    import havsfunc as haf
    file = r'C:\files\my_file.mp4'
    clip = core.ffms2.Source(file)
    clip = core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = haf.QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    or
    Code:
    from vapoursynth import core
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    clip = core.ffms2.Source(file)
    clip = core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    or
    Code:
    import vapoursynth as vs
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    clip = vs.core.ffms2.Source(file)
    clip = vs.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    this last example notice one important think from Pythonic point of view, core is an attribute of vapoursyth. Think of it like core is a function of vapoursynth and you can call it using that '.' between vapoursynth and core. So something is almost always atrribute of something above
    you might for example do this:
    Code:
    import vapoursynth as vs
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    load = vs.core.ffms2.Source
    clip = load(file)
    clip = vs.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    load= vs.core.ffms2.Source , and it is going to work, but it starts to be unreadable, so not a good idea to do that

    that 'r' character in front of quotes for string means to ignore backslash characters , it is used only in windows in python to make sure a path string would be correct, because strings use '\' as a character to signal some function and read a character right after, for example \n means a new line, so 'something\nagain' if you print it, you'd get:
    something
    again

    in linux you do not have to use that 'r' because linux uses '/' character in paths, or in windows you do not have to use that r character but you'd need to double all backslashes like C:\\path ....
    Last edited by _Al_; 8th Feb 2019 at 22:38.
    Quote Quote  
  5. Originally Posted by _Al_ View Post
    Using Vapoursynth you directly write a script in Python language. You can name your script *.py , not necessarily *.vpy and it is going to work. Consoles (that you write in python) would not read vpy at first.

    Python import function is an equivalent to import *.avsi in Avisynth, except it is tons of more powerful because having Python going on you can import moduls of shear power to do almost anything because Python modul library is extremely large.

    in case of havsfunc.py, that is a legit Pyhon script and if you want to import it into your script , it is called importing modul havsfunc.

    Sometimes it is better to start with basics, for example, so your QTGMC script could be:
    Code:
    import vapoursynth
    import havsfunc
    file = r'C:\files\my_file.mp4'
    clip = vapoursynth.core.ffms2.Source(file)
    clip = vapoursynth.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = havsfunc.QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    but they like to shorten everything and loading those moduls in shorter ways so you could get:
    Code:
    from vapoursynth import core
    import havsfunc as haf
    file = r'C:\files\my_file.mp4'
    clip = core.ffms2.Source(file)
    clip = core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = haf.QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    or
    Code:
    from vapoursynth import core
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    clip = core.ffms2.Source(file)
    clip = core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    or
    Code:
    import vapoursynth as vs
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    clip = vs.core.ffms2.Source(file)
    clip = vs.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    this last example notice one important think from Pythonic point of view, core is an attribute of vapoursyth. Think of it like core is a function of vapoursynth and you can call it using that '.' between vapoursynth and core. So something is almost always atrribute of something above
    you might for example do this:
    Code:
    import vapoursynth as vs
    from havsfunc import QTGMC
    file = r'C:\files\my_file.mp4'
    load = vs.core.ffms2.Source
    clip = load(file)
    clip = vs.core.std.SetFrameProp(clip, prop="_FieldBased", intval=2) #intval=1 for bff , 2 for tff, 0 for frame based
    clip = QTGMC(clip, Preset='Fast', TFF=True) 
    clip.set_output()
    load= vs.core.ffms2.Source , and it is going to work, but it starts to be unreadable, so not a good idea to do that

    that 'r' character in front of quotes for string means to ignore backslash characters , it is used only in windows in python to make sure a path string would be correct, because strings use '\' as a character to signal some function and read a character right after, for example \n means a new line, so 'something\nagain' if you print it, you'd get:
    something
    again

    in linux you do not have to use that 'r' because linux uses '/' character in paths, or in windows you do not have to use that r character but you'd need to double all backslashes like C:\\path ....
    Wow thanks I think I understood everything hopefully I'll manage to do everything I wanted Fromm here , thanks!
    Quote Quote  
  6. Originally Posted by _Al_ View Post
    Using Vapoursynth you directly write a script in Python language. You can name your script *.py , not necessarily *.vpy and it is going to work. Consoles (that you write in python) would not read vpy at first....
    ok i got how to run filters that needs just its own plugin (sharpen , blur , DeHalo_alpha etc) but it seems that there is a problem running stuff that needs bunch of plugins working tougether.
    for example "MCTemporalDenoise" is included in the "HAvsFunc" py package but when calling it (or any other more complex filter , for example Smoothlevels , MCTemporalDenoise...

    here is the error it gives me
    Code:
    from vapoursynth import core
    import muvsfunc as puf
    import mvsfunc as muf
    import havsfunc as kuf
    
    
    
    clip = core.ffms2.Source(r'D:\Z.mp4')
    
    clip = kuf.MCTemporalDenoise(clip,settings="very low")
    clip.set_output()
    gives
    Code:
    Failed to evaluate the script:
    Python exception: No attribute with the name dfttest exists. Did you mistype a plugin namespace?
    
    Traceback (most recent call last):
    File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
    File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
    File "D:/Untid.vpy", line 9, in 
    clip = core.ffms2.Source(r'D:\Z.mp4')
    File "src\cython\vapoursynth.pyx", line 1660, in vapoursynth._CoreProxy.__getattr__
    File "src\cython\vapoursynth.pyx", line 1522, in vapoursynth.Core.__getattr__
    AttributeError: No attribute with the name dfttest exists. Did you mistype a plugin namespace?
    i guess it just cant find the other plugins needed in order for the script to work.

    it states here https://forum.doom9.org/showthread.php?t=139766 , what filters are needed to run "MCTemporalDenoise" , in avisyth ill just putt their dlls in the plugins folder, in vapor synth it seems that even tho "havsfunc" has the filter itself in the package , it doesnt have the plugins that are needed to run it in the same .py

    with smoothlevels it gives me this
    Code:
    from vapoursynth import core
    import muvsfunc as puf
    import mvsfunc as muf
    import havsfunc as kuf
    
    clip = core.ffms2.Source(r'D:\Z.mp4')
    clip = kuf.SmoothLevels(clip,30, 0.85, 246, 5, 255)
    clip.set_output()
    error :
    Code:
    Failed to evaluate the script:
    Python exception: can't convert complex to float
    
    Traceback (most recent call last):
    File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
    File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
    File "D:/Untid.vpy", line 10, in 
    clip = kuf.
    File "C:\Users\Perfect Plan\VapourSynth\havsfunc.py", line 3985, in SmoothLevels
    level = core.std.Lut(limitI, planes=[0], function=get_lut)
    File "src\cython\vapoursynth.pyx", line 1833, in vapoursynth.Function.__call__
    vapoursynth.Error: can't convert complex to float
    Quote Quote  
  7. It tells you the error , just like avisynth

    No attribute with the name dfttest exists
    So you're missing dfttest . Download and place DFTTest.dll in plugins64 folder

    A good database for search, links for vpy plugins / scripts
    http://vsdb.top/


    For the smoothlevels error , you have to split out the gamma with 2 calls
    Code:
    clip = kuf.SmoothLevels(clip, input_low=30, gamma=1, input_high=246, output_low=5, output_high=255)
    clip = kuf.SmoothLevels(clip, input_low=0, gamma=0.85, input_high=255, output_low=0, output_high=255)
    Quote Quote  
  8. Originally Posted by poisondeathray View Post
    It tells you the error , just like avisynth

    No attribute with the name dfttest exists
    So you're missing dfttest . Download and place DFTTest.dll in plugins64 folder

    A good database for search, links for vpy plugins / scripts
    http://vsdb.top/


    For the smoothlevels error , you have to split out the gamma with 2 calls
    Code:
    clip = kuf.SmoothLevels(clip, input_low=30, gamma=1, input_high=246, output_low=5, output_high=255)
    clip = kuf.SmoothLevels(clip, input_low=0, gamma=0.85, input_high=255, output_low=0, output_high=255)
    thanks ! , any alternatives to

    TFM()
    TDecimate(Mode=1)

    for dvd deinterlacing and removing the extra frame ?
    Quote Quote  
  9. Originally Posted by zanzar View Post
    any alternatives to

    TFM()
    TDecimate(Mode=1)

    for dvd deinterlacing and removing the extra frame ?
    VIVTC . But its missing some of the additional features and modes of avisynth's TIVTC. But it should be sufficient for simple/standard IVTC

    http://www.vapoursynth.com/doc/plugins/vivtc.html


    Or you can use avisynth and vapoursynth . Recall the AVISource workaround mentioned earlier (you can do the IVTC part in avisynth, then feed that script into vapoursynth with AVISource). TIVTC is definitely better for complex DVD's which are not simple/standard

    eg. feeding avisynth script into vapoursynth script
    Code:
    clip = core.avisource.AVISource(r'PATH\avs_script.avs')
    Quote Quote  
  10. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post
    any alternatives to

    TFM()
    TDecimate(Mode=1)

    for dvd deinterlacing and removing the extra frame ?
    VIVTC . But its missing some of the additional features and modes of avisynth's TIVTC. But it should be sufficient for simple/standard IVTC

    http://www.vapoursynth.com/doc/plugins/vivtc.html


    Or you can use avisynth and vapoursynth . Recall the AVISource workaround mentioned earlier (you can do the IVTC part in avisynth, then feed that script into vapoursynth with AVISource). TIVTC is definitely better for complex DVD's which are not simple/standard

    eg. feeding avisynth script into vapoursynth script
    Code:
    clip = core.avisource.AVISource(r'PATH\avs_script.avs')
    hmmm , using a script to use other script with other program , neat.
    does it have any drawbacks like slower processing? , i dont really use any complex dvds
    Quote Quote  
  11. Originally Posted by zanzar View Post
    does it have any drawbacks like slower processing? , i dont really use any complex dvds
    Yes, slower. But if you're using things like waifu2x, it won't be a bottleneck

    Anything that is hard telecine but not strict cadence, or if it has combing will usually be slightly worse with VIVTC than using avisynth alternative. I would only trust VIVTC with clean DVD, strict cadence, no combing.

    TFM() in default mode has pp comb detection and low quality deinterlace. Otherwise you should use pp=0 if absolutely no combing, or use clip2 for higher quality deinterlacer on combed
    Quote Quote  
  12. Originally Posted by poisondeathray View Post
    Originally Posted by zanzar View Post
    does it have any drawbacks like slower processing? , i dont really use any complex dvds
    Yes, slower. But if you're using things like waifu2x, it won't be a bottleneck

    Anything that is hard telecine but not strict cadence, or if it has combing will usually be slightly worse with VIVTC than using avisynth alternative. I would only trust VIVTC with clean DVD, strict cadence, no combing.

    TFM() in default mode has pp comb detection and low quality deinterlace. Otherwise you should use pp=0 if absolutely no combing, or use clip2 for higher quality deinterlacer on combed
    well i do use the DVD iso files this seems to work

    Code:
    from vapoursynth import core
    
    clip = core.d2v.Source(r'D:\VIDEO_TS.d2v')
    clip = core.vivtc.VFM(clip,1)
    clip = core.vivtc.VDecimate(clip)
    
    clip.set_output()
    it just give me a deinterlaced 23.976 fps video with no duplicates. any reason why i should consider anything else? , specific scence i should watch that might go wrong and ill miss ? , its only anime from DVD's
    Quote Quote  
  13. If it's standard, strict cadence (3:2) , hasn't been edited while interlaced, no combing you should be ok (ie. a perfect DVD). Otherwise you might get wrong matches, combing artifacts. VIVTC has no comb pp by default

    Anime DVD's are typically bad for this, unless they are from a modern series release
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    If it's standard, strict cadence (3:2) , hasn't been edited while interlaced, no combing you should be ok (ie. a perfect DVD). Otherwise you might get wrong matches, combing artifacts. VIVTC has no comb pp by default

    Anime DVD's are typically bad for this, unless they are from a modern series release
    any advice on resizing the waifu2x downscale back to 720p?
    something like

    Code:
    clip = nnrs.nnedi3_resample(clip, clip.width * 0.75, clip.height * 0.75)
    or
    Code:
    clip = core.resize.Spline36(clip, 1280, 720)
    that would be close to
    Code:
    nnedi3_rpow2(2, cshift="spline64resize", fwidth=1280, fheight=720)
    Last edited by zanzar; 12th Feb 2019 at 17:37.
    Quote Quote  
  15. It won't make much of a difference for downsizing . You can preview and see what you like better
    Quote Quote  
  16. Originally Posted by poisondeathray View Post
    It won't make much of a difference for downsizing . You can preview and see what you like better
    last thing

    i cant get smoothlevels running
    Code:
    import vapoursynth as vs
    import muvsfunc as puf
    import mvsfunc as muf
    import havsfunc as kuf
    core = vs.get_core()
    clip = core.ffms2.Source(r'D:\Z.mp4')
    clip = kuf.SmoothLevels(clip, input_low=30, gamma=1, input_high=246, output_low=5, output_high=255)
    clip.set_output()
    error
    Code:
    Failed to evaluate the script:
    Python exception: There is no attribute or namespace named f3kdb
    
    Traceback (most recent call last):
    File "src\cython\vapoursynth.pyx", line 1927, in vapoursynth.vpy_evaluateScript
    File "src\cython\vapoursynth.pyx", line 1928, in vapoursynth.vpy_evaluateScript
    File "D:/Untid.vpy", line 7, in 
    File "C:\Users\Perfect Plan\VapourSynth\havsfunc.py", line 3993, in SmoothLevels
    process = core.std.Expr([process], [expr]).f3kdb.Deband(grainy=0, grainc=0, output_depth=input.format.bits_per_sample)
    File "src\cython\vapoursynth.pyx", line 1211, in vapoursynth.VideoNode.__getattr__
    AttributeError: There is no attribute or namespace named f3kdb
    i cant find the f3kdb dlls , "flash3kyuu_deband" is the only thing that was related to this and i am not sure how to use it (it looks like not everything there is related\needed)
    Quote Quote  
  17. Originally Posted by zanzar View Post

    i cant find the f3kdb dlls , "flash3kyuu_deband" is the only thing that was related to this and i am not sure how to use it (it looks like not everything there is related\needed)

    That's what it is

    If the github release does not have a compiled .dll , look in the discussion thread for links because someone probably already compiled it. (The database has links to the forum discussion thread too)

    eg
    https://forum.doom9.org/showthread.php?p=1841014#post1841014
    https://mega.nz/#F!Y10U2LiJ!2H29c5mv5npZiTMdtSwveg
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!