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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th November 2021, 14:34   #4601  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 73
I see. That's a nice excuse to not enumerating all the output nodes.
Yomiko is offline   Reply With Quote
Old 20th November 2021, 01:30   #4602  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
How do I pass in multiple nodes into a map programmatically for plugin such as StackHorizontal? Like this?

Code:
vsapi->mapConsumeNode(pArgumentMap, "clips", A_node, maAppend);
vsapi->mapConsumeNode(pArgumentMap, "clips", B_node, maAppend);
vsapi->mapConsumeNode(pArgumentMap, "clips", C_node, maAppend);

auto resultMap = vsapi->invoke(pStdPlugin, "StackHorizontal", pArgumentMap);
lansing is offline   Reply With Quote
Old 20th November 2021, 23:13   #4603  |  Link
amayra
Quality Checker
 
amayra's Avatar
 
Join Date: Aug 2013
Posts: 285
https://github.com/HomeOfAviSynthPlu...L-SMASH-Works/

this look like new repo for L-SMASH
__________________
I love Doom9
amayra is offline   Reply With Quote
Old 20th November 2021, 23:25   #4604  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Quote:
Originally Posted by amayra View Post
https://github.com/HomeOfAviSynthPlu...L-SMASH-Works/

this look like new repo for L-SMASH
Your only development for Avisynth. Here only development for Vapoursynth
https://github.com/AkarinVS/L-SMASH-Works/releases
kedautinh12 is online now   Reply With Quote
Old 21st November 2021, 19:43   #4605  |  Link
sl1pkn07
Pajas Mentales...
 
Join Date: Dec 2004
Location: Spanishtán
Posts: 496
Quote:
Originally Posted by kedautinh12 View Post
Your only development for Avisynth.

not at all. is dual interface
__________________
[AUR] Vapoursynth Stuff
[AUR] Avisynth Stuff
sl1pkn07 is offline   Reply With Quote
Old 21st November 2021, 21:10   #4606  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Quote:
Originally Posted by sl1pkn07 View Post
not at all. is dual interface
Dual but his link don't development for Vapoursynth anymore. And my link don't development for Avisynth anymore
kedautinh12 is online now   Reply With Quote
Old 17th December 2021, 04:26   #4607  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
Every year I'm dealing with the same installation issues:

Code:
File "src\cython\vapoursynth.pyx", line 2833, in vapoursynth._vpy_evaluate
  File "f:\jobs\interB.vpy", line 4, in <module>
    core = vs.get_core ()
AttributeError: module 'vapoursynth' has no attribute 'get_core'
It only works on the Python prompt:

Code:
Python 3.9.9 (tags/v3.9.9:ccb0e6a, Nov 15 2021, 18:08:50) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> from vapoursynth import core
>>> print(core.version())
VapourSynth Video Processing Library
Copyright (c) 2012-2021 Fredrik Mellbin
Core R57
API R4.0
API R3.6
What is going wrong here?!


EDIT:

I changed to this "core = vs.core ()". Appparently the powers that be decided to mess with the API. Fine, but now I get this:

Code:
Traceback (most recent call last):
  File "src\cython\vapoursynth.pyx", line 2832, in vapoursynth._vpy_evaluate
  File "src\cython\vapoursynth.pyx", line 2833, in vapoursynth._vpy_evaluate
  File "f:\jobs\interB.vpy", line 4, in <module>
    core = vs.core ()
TypeError: 'vapoursynth._CoreProxy' object is not callable
Or without the parentheses, just "Property read unsuccessful due to missing key but no error output: _SceneChangePrev"
__________________
Gorgeous, delicious, deculture!

Last edited by asarian; 17th December 2021 at 04:54.
asarian is offline   Reply With Quote
Old 17th December 2021, 04:52   #4608  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,377
Quote:
Originally Posted by asarian View Post
Every year I'm dealing with the same installation issues:

Code:
File "src\cython\vapoursynth.pyx", line 2833, in vapoursynth._vpy_evaluate
  File "f:\jobs\interB.vpy", line 4, in <module>
    core = vs.get_core ()
AttributeError: module 'vapoursynth' has no attribute 'get_core'
Now it's

Code:
core = vs.core
instead of

Code:
core = vs.get_core()
poisondeathray is offline   Reply With Quote
Old 17th December 2021, 04:59   #4609  |  Link
asarian
Registered User
 
Join Date: May 2005
Posts: 1,462
Quote:
Originally Posted by poisondeathray View Post
Now it's

Code:
core = vs.core
instead of

Code:
core = vs.get_core()
Thanks. I noticed that yes, but it throws a weird error about _SceneChangePrev (see above).


EDIT: Updated a zillion filters, and now all is good again.
__________________
Gorgeous, delicious, deculture!

Last edited by asarian; 17th December 2021 at 06:17.
asarian is offline   Reply With Quote
Old 1st January 2022, 18:09   #4610  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
I got the following script:
Code:
# Imports
import os
import sys
import ctypes
# Loading Support Files
Dllref = ctypes.windll.LoadLibrary("I:/Hybrid/64bit/vsfilters/Support/libfftw3f-3.dll")
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Import scripts folder
scriptPath = 'I:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/GrainFilter/RemoveGrain/RemoveGrainVS.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/GrainFilter/AddGrain/AddGrain.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/NEO_FFT3DFilter/neo-fft3d.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/DenoiseFilter/DFTTest/DFTTest.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/EEDI3m.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/ResizeFilter/nnedi3/vsznedi3.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/libmvtools.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/temporalsoften.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/scenechange.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/MiscFilter/MiscFilters/MiscFilters.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/Support/fmtconv.dll")
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll")
# Import scripts
import havsfunc
# source: 'C:\Users\Selur\Desktop\cnpolandecpnextbumpereliotkid.mp4'
# current color space: YUV420P8, bit depth: 8, resolution: 640x480, fps: 25, color matrix: 470bg, yuv luminance scale: limited, scanorder: bottom field first
# Loading C:\Users\Selur\Desktop\cnpolandecpnextbumpereliotkid.mp4 using DGSource
clip = core.dgdecodenv.DGSource("E:/Temp/mp4_7121ca84898db5944d8e11d671f2de4e_853323747.dgi",fieldop=2)
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
clip = core.fmtc.resample(clip=clip, kernel="spline16", w=320, h=240, interlaced=True, interlacedd=True)
# setting field order to what QTGMC should assume (bottom field first)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=1)
# Deinterlacing using QTGMC
clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False) # new fps: 25
# make sure content is preceived as frame based
clip = core.std.SetFieldBased(clip, 0)
clip = clip[::2]
# adjusting output color from: YUV420P16 to YUV420P8 for x264Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P8, range_s="limited")
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
which loads fine.
Trying to load the script inside another script:
Code:
# Imports
from importlib.machinery import SourceFileLoader
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# source: 'C:\Users\Selur\Desktop\small.vpy'
# current color space: YUV420P8, bit depth: 8, resolution: 320x240, fps: 25, color matrix: 470bg, yuv luminance scale: full, scanorder: progressive
# Loading C:\Users\Selur\Desktop\small.vpy
SourceFileLoader('clip', 'C:/Users/Selur/Desktop/small.vpy').load_module()
clip = vs.get_output()
# making sure input color matrix is set as 470bg
clip = core.resize.Bicubic(clip, matrix_in_s="470bg",range_s="full")
# making sure frame rate is set to 25.000
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# set output frame rate to 25.000fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()
I get;
Code:
Failed to evaluate the script:
Python exception: Bicubic: argument clip was passed an unsupported type (expected vnode compatible type but got NoneType)
I used the above back wit API3 and there iirc it worked fine. (https://forum.doom9.org/showthread.php?t=175098)
My guess is that something changed in API4 which I'm not aware of.

-> Does anyone know how to load one script inside another ?

Cu Selur
__________________
Hybrid here in the forum, homepage

Last edited by Selur; 2nd January 2022 at 09:12.
Selur is offline   Reply With Quote
Old 1st January 2022, 20:15   #4611  |  Link
quietvoid
Registered User
 
Join Date: Jan 2019
Location: Canada
Posts: 574
I think it's because you're using the parent script's vs module (which uses another core?).
This works for both API3/API4 compatibility:

Code:
output = SourceFileLoader('script', filepath).load_module().vs.get_output()

try:
    if isinstance(output, vs.VideoOutputTuple):
        clip = output.clip
    else:
        clip = output
except AttributeError:
    clip = output
Because API4 is returning a clip + alpha tuple.
__________________
LG C2 OLED | GitHub Projects
quietvoid is offline   Reply With Quote
Old 1st January 2022, 21:22   #4612  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
To get clips fro vapoursynth scripts you can use this:
Code:
import vapoursynth as vs
from vapoursynth import core
from importlib.machinery import SourceFileLoader
from pathlib import Path

API4 = vs.__api_version__.api_major >= 4

class NoClipError(Exception):
    pass

def vs_Source(script_path, wanted_output=None, **kwargs):
    '''if no wanted_output is passed it returns first available'''
    vs.clear_outputs()
    vs_found_outputs = list(SourceFileLoader('script', script_path).load_module().vs.get_outputs().keys())

    if not vs_found_outputs:
        vs_output_index = wanted_output
        raise NoClipError(f'No output found in "{Path(script_path).name}", clip.set_output() needs to be added to the script')
    if wanted_output is None:
        first_output =  next(iter(vs.get_outputs()))
        clip = vs.get_output(first_output)[0] if API4 else vs.get_output(first_output)
        vs_output_index = first_output
    else:
        try:
            clip = vs.get_output(wanted_output)[0] if API4 else vs.get_output(wanted_output)
        except KeyError:
            raise NoClipError(f'Output index {wanted_output} not found in "{Path(script_path).name}"')
        vs_output_index = wanted_output
        
    #optional, writing output index and all available outputs to clips prop
    if API4:
        clip = clip.std.SetFrameProps(vs_found_outputs=vs_found_outputs)
        clip = clip.std.SetFrameProps(vs_output_index=vs_output_index)
    else:
        clip = clip.std.SetFrameProp(prop="vs_found_outputs", data=','.join(list(map(str,vs_found_outputs))))
        clip = clip.std.SetFrameProp(prop="vs_output_index", intval=vs_output_index)
    return clip

script_path = 'C:/Users/Selur/Desktop/small.vpy'
clip = vs_Source(script_path)
because of API4 changes (vs.get_outputs(), f.get_read_array(), SetFrameProps(allows to store a list now, perhaps other python objects), it is a good idea to have on top of script boolean what API is used and then split action, vs.get_outputs() was mentioned, then frame array example:
Code:
if    API4: planes =[f[i] for i in range(f.format.num_planes)]
else:       planes =[f.get_read_array(i) for i in range(f.format.num_planes)]
_Al_ is offline   Reply With Quote
Old 2nd January 2022, 09:12   #4613  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,277
Thanks! That works fine, since I only use API4 I'll stick with quietvvoids solution.

Cu Selur
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 2nd January 2022, 12:52   #4614  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
There's an api3-api4 bridge now for older VS versions.
Quote:
Suppose you are stuck with VS R54, but you want to use a video plugin filter.dll that only has api4 support.
You can download the released api3.dll and save it as filter.api3.dll along side with filter.dll into VS plugins directory.
And then you should be able to use the filter in api3 VS as usual.
https://github.com/AmusementClub/vs-api3/releases
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 5th January 2022, 01:41   #4615  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
Quote:
Originally Posted by Selur View Post
Thanks! That works fine, since I only use API4 I'll stick with quietvvoids solution.

Cu Selur
Yes, like that, clip output must be set always to zero, or as a default clip.set_output().
If it is an unknown script,
-video output could be put in a different index, or as happens all the time to me, actually forgetting to set output, so it should take care of that , not to crash python.
-check if it is audio actually, not video,

Is there a way to figure out video-audio pairing from outputs, or can user "mark" it somehow that an audio output matches what video output?
There should be something to mark those outputs as a pair. Is there something like that?

So far for example there could be output like this(2 video outputs and one audio):
Code:
clip.set_output(0)
audio.set_output(1)
clip2.set_output(2)
>>>print(vs.get_outputs())
0: VideoOutputTuple(clip=<vapoursynth.VideoNode object at 0x0000021CC20F4940>, alpha=None, alt_output=0),
1: <vapoursynth.AudioNode object at 0x0000021CC20F49C0>,
2: VideoOutputTuple(clip=<vapoursynth.VideoNode object at 0x0000021CC20F4940>, alpha=None, alt_output=0)}
Or is there going to be a consensus to always interleave video and audio outputs? That's arbitrary though not safe way to handle unknown script. Some kind of info binding might be helpful.

Last edited by _Al_; 5th January 2022 at 01:47.
_Al_ is offline   Reply With Quote
Old 5th January 2022, 15:48   #4616  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
> Or is there going to be a consensus to always interleave video and audio outputs?
There is no interleaving in nodes, they are separate objects and you have to query data on every node independently. However if you asking for automation of stuff, there's 2 possible solutions that coming onto my mind:
1) assume node 0 is video and node 1 is audio (that actually used in avfs)
2) probe every node until reach 1 video and 1 audio, discard further evaluation
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 9th January 2022, 00:16   #4617  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
ok, I guess it is not important or it could be worked with because an individual works with it, it is not shared, like chopping video etc.

I'd like to correct script from above to pull a VideoNode output from script only, not AudioNodes, which I forgot about:

Code:
class NoClipError(Exception):
    pass

API4 = vs.__api_version__.api_major >= 4

def vs_Source(script_path, wanted_output_index=None, **kwargs):
    '''
    loads vapoursynth vs.VideoNode outputs from vapoursynth script,
    if wanted_output_index (int) is not passed, it gets first available vs.VideoNode if any
    vs.AudioNodes are ignored
    '''
    vs.clear_outputs()
    SourceFileLoader('script', script_path).load_module()
    if API4: instance = vs.VideoOutputTuple
    else:    instance = vs.VideoNode
    video_output_indexes = [index for index, output in vs.get_outputs().items() if isinstance(output, instance)]
    if not video_output_indexes:
        raise NoClipError(f'No video output found in "{Path(script_path).name}", vnode.set_output() needs to be added to the script')
    if wanted_output_index is None:
        index = video_output_indexes[0]
    else:
        if wanted_output_index not in video_output_indexes:
            raise NoClipError(f'Wanted video output index: {wanted_output_index} not found in "{Path(script_path).name}" or index is not a video output')
        index = wanted_output_index
    return vs.get_output(index)[0] if API4 else vs.get_output(index)

clip = vs_Source("some_vapoursynth_script.vpy")
_Al_ is offline   Reply With Quote
Old 9th January 2022, 05:25   #4618  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 1,420
Quote:
Originally Posted by asarian View Post
Is R65 broken somehow? At first I blamed Windows 11's new termimal for the very slow throughput (slow pipe transfer?), but nope, even using ffmepeg with -vapoursynth, the process is extremely slow, using CPU for only like 25%. Both QTGMC and MCTemporalDenoise seem to grind to a near halt. All on my new i9 12900K. This used to go blistering fast, even on my old 6700K.

Here's what I do (see below). It's almost as if multi-threading is broken for these two functions (it isn't, but appears to work exceedngly inefficient). This is 4K material, btw.

Code:
import vapoursynth as vs
import havsfunc as haf

core = vs.core
core.max_cache_size = 65535

vid = core.dgdecodenv.DGSource (r'c:\jobs\am.dgi', ct=44, cb=44, cl=0, cr=0)

vid = haf.QTGMC (vid, InputType=1, Preset="Very Slow", TR2=3, EdiQual=2, EZDenoise=0.5, NoisePreset="Slower", TFF=True, Denoiser="KNLMeansCL")
vid = haf.MCTemporalDenoise (vid, settings="very low", stabilize=True)
vid = core.neo_f3kdb.Deband (vid, preset="veryhigh", dither_algo=2)
vid = core.std.AddBorders (clip=vid, left=0, right=0, top=44, bottom=44)

vid.set_output ()
Love to learn what's going on.
And is it using only the Performance cores, or is it getting confused and either only using the Efficiency cores, or mixing up the two and throwing tasks to both types, which will bottleneck the P-cores to whatever speed the E-cores are going at?
qyot27 is online now   Reply With Quote
Old 9th January 2022, 07:55   #4619  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,784
Try https://frupic.frubar.net as simple image hoster.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 15th January 2022, 06:23   #4620  |  Link
lewyturn
Registered User
 
Join Date: May 2019
Posts: 18
How to use "std.SplitPlanes(vnode clip)'", I can't find an example, can anyone give me an example?
lewyturn is offline   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:50.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.