This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Adding script to Vapoursynth in Hybrid
#1
Hello, question:

If I want to add the following import and filter commands to VapourSynth script in Hybrid, how do I do this?

import vapoursynth as vs
core = vs.get_core()
import fvsfunc as fvf
import kagefunc as kgf
import fag3kdb as Fag3kdb
core.max_cache_size = 8192
##############################################
clip = core.lsmas.LWLibavSource(r"G:\SOURCE PATH AND FILE NAME.mkv")
clip = core.fmtc.bitdepth(clip, bits=16)
RESCALE = fvf.DescaleAA(clip, 1600, 900, kernel='bicubic', b=0, c=0.5, thr=7, expand=9)
DENOISE = core.fft3dfilter.FFT3DFilter(RESCALE)
DEBAND = core.f3kdb.Deband(DENOISE, range=12, y=60, cb=40, cr=40, grainy=0, grainc=0, output_depth=16)
GRAIN = kgf.adaptive_grain(DEBAND, strength=0.10, static=True, show_mask=False)
clip = core.fmtc.bitdepth(GRAIN, bits=10)
##############################################
clip.set_output()


*** I tried adding them in Custom "Before END" and it does not seem to work. Can you perhaps guide me?
**** Also, where do I copy new *.vs script files for Vapoursynth, such as kagefunc.py? Again I tried and it did not seem to work. Guidance please...?

Thank you - Garo
Reply
#2
1. Hybrid does not support any sort of templating.
2. Custom section is the right place if you want to add content.
3. Hybrid doesn't care where you put your stuff as long as you properly load it in Vapoursynth.

So your main problem is you need to understand how Python/Vapoursynth works. Smile

=>
Short answer: Sorry to tell you, but Hybrid isn't customisable the way you want to.

Long answer:

To be able to import fvsfunc as fvf you Vapoursynth/Python must know the fvsfunc.py file.
To archive this you either need to place them into the folders Vapoursynth automatically loads scripts form (see: http://www.vapoursynth.com/doc/plugins.html), or manually tell Hybrid to import scripts from a specific folder.
Hybrid does the later whenever a script is used by is using:
# Imports
import os
import sys
import vapoursynth as vs
core = vs.get_core()
# Import scripts folder
scriptPath = 'PATH TO "Hybrid/64bit/vsscripts"'
sys.path.append(os.path.abspath(scriptPath))
to let Vapoursynth know about the scripts inside the vsscripts-folder.

So to be able for Vapoursynth to understand:
import fvsfunc as fvf
import kagefunc as kgf
import fag3kdb as Fag3kdb
beforehand they need to be placed into a folder and that folder needs to be appended to the system path like I described (or placed into one of the folders Vapoursynth automatically searches through).

The same is true for filters in .dll form, Vapoursynth needs to know of them, so they either need to be loaded explicitly
for example through:
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
or placed inside one of the autoload folders.

So your custom addition must:
1. let vapoursynth know about the scripts (or they need to be placed inside one of the autoload folders)
2. import the scripts
import fvsfunc as fvf
import kagefunc as kgf
import fag3kdb as Fag3kdb
3. load all for the script necessary filters (or they need to be placed inside one of the autoload folders)
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/FFMS2/ffms2.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/FFT3DFilter/fft3dfilter.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DebandFilter/Flash3kDeband/flash3kyuu_deband.dll")
(no clue whether your scripts have any additional dependencies)
Small warning: scripts will crash if a filter is in an autoload folder and explicitly loaded.
4. do what ever you want it to do:
RESCALE = fvf.DescaleAA(clip, 1600, 900, kernel='bicubic', b=0, c=0.5, thr=7, expand=9)
DENOISE = core.fft3dfilter.FFT3DFilter(RESCALE)
DEBAND = core.f3kdb.Deband(DENOISE, range=12, y=60, cb=40, cr=40, grainy=0, grainc=0, output_depth=16)
GRAIN = kgf.adaptive_grain(DEBAND, strength=0.10, static=True, show_mask=False)

-> this is all really straight forward assuming you know how basic Vapoursynth works.
Hope this helps a bit.

So now to the bad news: Your script addition is not compatible with Hybrids custom option since it changes the resolution and Hybrid has not the ability to know this so using your script with Hybrid will not work.

=> Sorry to tell you, but Hybrid isn't customisable the way you want to.

Cu Selur

Ps.: Assuming the script you use can be previewed in vsViewer or Vapoursynth Editor you can use it as source in Hybrid.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)