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. |
20th November 2021, 01:30 | #4602 | Link |
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); |
20th November 2021, 23:25 | #4604 | Link | |
Registered User
Join Date: Jan 2018
Posts: 2,156
|
Quote:
https://github.com/AkarinVS/L-SMASH-Works/releases |
|
17th December 2021, 04:26 | #4607 | Link |
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' 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 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
__________________
Gorgeous, delicious, deculture! Last edited by asarian; 17th December 2021 at 04:54. |
17th December 2021, 04:52 | #4608 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
Code:
core = vs.core Code:
core = vs.get_core() |
|
17th December 2021, 04:59 | #4609 | Link | |
Registered User
Join Date: May 2005
Posts: 1,462
|
Quote:
EDIT: Updated a zillion filters, and now all is good again.
__________________
Gorgeous, delicious, deculture! Last edited by asarian; 17th December 2021 at 06:17. |
|
1st January 2022, 18:09 | #4610 | Link |
Registered User
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() 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() Code:
Failed to evaluate the script: Python exception: Bicubic: argument clip was passed an unsupported type (expected vnode compatible type but got NoneType) 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 Last edited by Selur; 2nd January 2022 at 09:12. |
1st January 2022, 20:15 | #4611 | Link |
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
__________________
LG C2 OLED | GitHub Projects |
1st January 2022, 21:22 | #4612 | Link |
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) 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)] |
2nd January 2022, 12:52 | #4614 | Link | |
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,795
|
There's an api3-api4 bridge now for older VS versions.
Quote:
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth VapourSynth Portable FATPACK || VapourSynth Database |
|
5th January 2022, 01:41 | #4615 | Link | |
Registered User
Join Date: May 2011
Posts: 321
|
Quote:
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)} Last edited by _Al_; 5th January 2022 at 01:47. |
|
5th January 2022, 15:48 | #4616 | Link |
Registered User
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 |
9th January 2022, 00:16 | #4617 | Link |
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") |
9th January 2022, 05:25 | #4618 | Link | |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
Quote:
|
|
9th January 2022, 07:55 | #4619 | Link |
German doom9/Gleitz SuMo
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,784
|
Try https://frupic.frubar.net as simple image hoster.
|
Tags |
speed, vaporware, vapoursynth |
|
|