Log in

View Full Version : Vapoursynth


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 [85] 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

feisty2
7th February 2021, 08:32
But I need to wrap the whole script inside this warnings.catch_warnings in order to catch them.

no need.


import logging

class MessageAbsorber(logging.Handler):
def __init__(self, MessageContainer):
logging.Handler.__init__(self)
self.MessageContainer = MessageContainer
def emit(self, MessageRecord):
self.MessageContainer += [MessageRecord.getMessage()]

WarningMessages = []
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

def PassWarningMessagesToCxxPrograms():
return WarningMessages

# user script goes here

core.vsedit.PythonEval(PassWarningMessagesToCxxPrograms)

lansing
8th February 2021, 06:34
no need.


import logging

class MessageAbsorber(logging.Handler):
def __init__(self, MessageContainer):
logging.Handler.__init__(self)
self.MessageContainer = MessageContainer
def emit(self, MessageRecord):
self.MessageContainer += [MessageRecord.getMessage()]

WarningMessages = []
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

def PassWarningMessagesToCxxPrograms():
return WarningMessages

# user script goes here

core.vsedit.PythonEval(PassWarningMessagesToCxxPrograms)

I came to understand the logging part after some reading, but I still don't get the last line, what is this PythonEval() and how does it talk to C++?

The script will be pass to vsscript_evaluateScript(), which doesn't return warning messages. Where do this PythonEval() play in the process?

feisty2
8th February 2021, 07:29
PythonEval() is a special C++ filter that takes a python function as its argument and returns nothing. it's somewhat similar to std.LoadPlugin() or std.SetMaxCPU() in terms of functionality (an infrastructure function rather than an actual filter that applies some processing to a video clip). its implementation should be something similar to #4274, basically it retrieves the warning messages by calling the foreign python function and sends all retrieved messages to stderr thru vsapi->logMessage()

lansing
8th February 2021, 09:49
PythonEval() is a special C++ filter that takes a python function as its argument and returns nothing. it's somewhat similar to std.LoadPlugin() or std.SetMaxCPU() in terms of functionality (an infrastructure function rather than an actual filter that applies some processing to a video clip). its implementation should be something similar to #4274, basically it retrieves the warning messages by calling the foreign python function and sends all retrieved messages to stderr thru vsapi->logMessage()

If I get this right, you're saying to create a dummy vs filter to sends the collected messages through stdder, and then in the C++ side, retrieve the messages through stdder and then output them with vsapi->logMessage()?

feisty2
8th February 2021, 10:02
no, it sends the collected messages TO stderr BY USING vsapi->logMessage(), read the documentation of vaporsynth's C API. any string passed to logMessage() already automatically appears in vsedit, you don't need any extra stuff.

lansing
8th February 2021, 10:18
no, it sends the collected messages TO stderr BY USING vsapi->logMessage(), read the documentation of vaporsynth's C API. any string passed to logMessage() already automatically appears in vsedit, you don't need any extra stuff.

So the chain would be like this?

collected messages -> dummy vs filter -> inside dummy vs filter -> logMessage()

feisty2
8th February 2021, 10:20
yes,,,

lansing
8th February 2021, 10:31
yes,,,

Thanks, I'll work on it.

feisty2
10th February 2021, 10:34
@Myrsloik
should I release *frameData instantly if an exception is thrown from the arAllFramesReady branch? or should I just leave it unhandled and expect it gets deleted when getFrame() is invoked again with arError?

basically, this

try {
if (auto& ResourceHandle = reinterpret_cast<ResourceType*&>(*frameData); activationReason == arInitial)
ResourceHandle = new auto{ FilterInstance->AcquireResources(...) };
else if (activationReason == arAllFramesReady) {
auto ManagedResourceHandle = std::unique_ptr<ResourceType>{ ResourceHandle };
auto GeneratedFrame = FilterInstance->DrawFrame(*ManagedResourceHandle, ...);
// if DrawFrame() throws an exception, *ResourceHandle is instantly released
// by the destructor of std::unique_ptr

return GeneratedFrame.ReleaseOwnership();
}
else if (activationReason == arError)
delete ResourceHandle;
// possible double-free here?

return nullptr;
}
catch (RuntimeError& ErrorMessage) {
FrameContext.RaiseError(ErrorMessage);
return nullptr;
}

or this

try {
if (auto& ResourceHandle = reinterpret_cast<ResourceType*&>(*frameData); activationReason == arInitial)
ResourceHandle = new auto{ FilterInstance->AcquireResources(...) };
else if (activationReason == arAllFramesReady) {
auto GeneratedFrame = FilterInstance->DrawFrame(*ResourceHandle, ...);
// no leak if DrawFrame() throws an exception
// *ResourceHandle will be released later from the arError branch

delete ResourceHandle;
return GeneratedFrame.ReleaseOwnership();
}
else if (activationReason == arError)
delete ResourceHandle;
return nullptr;
}
catch (RuntimeError& ErrorMessage) {
FrameContext.RaiseError(ErrorMessage);
return nullptr;
}

?

Myrsloik
10th February 2021, 10:39
@Myrsloik
should I release *frameData instantly if an exception is thrown from the arAllFramesReady branch? or should I just leave it unhandled and expect it gets deleted when getFrame() is invoked again with arError?

basically, this
...
?

You can't get an "exception" or error in arAllFramesReady. All frames are already successfully produced so I'm not sure what you're asking. And if there is an error arAllFramesReady won't be called, only arError, so obviously you should free the frameData there.

feisty2
10th February 2021, 10:49
the exception is thrown from the user defined function DrawFrame() when for instance, a required frame property is missing from the input (basically any situation that involves setFilterError() in a C plugin).

feisty2
10th February 2021, 11:02
oh I see, I think I kinda get it now, so arError indicates error getting an input frame, not error in an attempt to generate an output frame, is that right?

Myrsloik
10th February 2021, 11:22
oh I see, I think I kinda get it now, so arError indicates error getting an input frame, not error in an attempt to generate an output frame, is that right?

Exactly!

lansing
11th February 2021, 07:32
Thanks, I'll work on it.

I have created a dummy filter and passed in a list from the script to the filter, but I couldn't figure out the right syntax to retrieve it in C.

script
core.vsedit.Logger(["message 1", "message 2"])

dummy.c

static void VS_CC logger(VSMap* in, VSMap* out, void *userData, VSCore* core, const VSAPI* vsapi) {
char messages[] = vsapi->propGetData(in, "name", 0, NULL);

int i = 0;
while (messages[i]) {
vsapi->logMessage("WARNING", messages[i]);
i++;
}
}

VS_EXTERNAL_API(void) VapourSynthPluginInit(VSConfigPlugin configFunc, VSRegisterFunction registerFunc, VSPlugin* plugin) {
configFunc("com.vsedit.logger", "vsedit", "VapourSynth Logger", VAPOURSYNTH_API_VERSION, 1, plugin);
registerFunc("Logger", "name:data[]", &logger, 0, plugin);
}


I couldn't get this to compile.

feisty2
11th February 2021, 09:06
auto logger(auto in, auto, auto, auto, auto vsapi) {
for (auto x : Range{ vsapi->propNumElements(in, "name") })
vsapi->logMessage(VSMessageType::mtWarning, vsapi->propGetData(in, "name", x, nullptr));
}

feisty2
11th February 2021, 09:28
char messages[] = vsapi->propGetData(in, "name", 0, NULL);


apparently you're not very familiar with C constructs, you cannot initialize a char array from a pointer (note that string literals are of type const char[N], not const char*, an array type can decay to a pointer type, but arrays and pointers are distinct entities). it's better if you just avoid C stuff all together.

lansing
11th February 2021, 09:44
apparently you're not very familiar with C constructs, you cannot initialize a char array from a pointer (note that string literals are of type const char[N], not const char*, an array type can decay to a pointer type, but arrays and pointers are distinct entities). it's better if you just avoid C stuff all together.

Yes C is confusing to me, it gave me a headache even trying to do simple thing like converting int to string.

lansing
11th February 2021, 17:07
I got the dummy filter printing messages now, but for some reason the logging module is not catching warnings on evaluation


import logging

class MessageAbsorber(logging.Handler):
def __init__(self, message_container):
logging.Handler.__init__(self)
self.messageContainer = message_container
def emit(self, message_record):
self.messageContainer += [message_record.getMessage()]

WarningMessages = []
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

def get_warnings():
return WarningMessages

import vapoursynth as vs

core = vs.get_core()
core2 = vs.get_core()
core3 = vs.get_core()
clip = core.dgdecodenv.DGSource(r'video.dgi')
clip.set_output()

core.vsedit.Logger(get_warnings())

The same codes worked on PyCharm, but in vseditor, I'm getting error about the WarningMessages list still being empty. It will print if I passed in a list core.vsedit.Logger(["message1", "message2"])

Update: I think the reason for this is because vs disabled the warnings so they aren't even logged.

feisty2
12th February 2021, 13:20
@Myrsloik
Does the flags field of the VSVideoInfo object passed to setVideoInfo() partially determine the cache mode of the output node (along with the flags argument passed to createFilter()), or is it simply ignored?

Myrsloik
12th February 2021, 13:27
@Myrsloik
Does the flags field of the VSVideoInfo object passed to setVideoInfo() partially determine the cache mode of the output node (along with the flags argument passed to createFilter()), or is it simply ignored?

It's simply ignored and is filled out with the flags passed to createFilter()

lansing
18th February 2021, 03:02
What is the correct scenario for use of setting max cache size? I have a 1080i source with QTGMC(Preset='Medium'), setting max cache size to 4000 MB will give me a "script exceeded memory limit" warning, raising it to 12,000 MB will clear the warning, but there is no difference in speed on benchmark at 41 fps.

feisty2
23rd February 2021, 12:29
I got the dummy filter printing messages now, but for some reason the logging module is not catching warnings on evaluation

The same codes worked on PyCharm, but in vseditor, I'm getting error about the WarningMessages list still being empty. It will print if I passed in a list core.vsedit.Logger(["message1", "message2"])

Update: I think the reason for this is because vs disabled the warnings so they aren't even logged.

add these 2 lines

import logging
import warnings

class MessageAbsorber(logging.Handler):
def __init__(self, MessageContainer):
logging.Handler.__init__(self)
self.MessageContainer = MessageContainer
def emit(self, MessageRecord):
self.MessageContainer += [MessageRecord.getMessage()]

WarningMessages = []
warnings.simplefilter('always')
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

# user script goes here

core.vsedit.PrintWarnings(WarningMessages)

feisty2
28th February 2021, 17:44
@Myrsloik
could you add

const char* getPluginName(VSPlugin*);
const char* getPluginNamespace(VSPlugin*);
const char* getPluginIdentifier(VSPlugin*);
const char* getPluginFunctionArguments(VSPlugin*, const char* functionName);

to APIv3? so the instantiation of a single plugin object or plugin func object can get rid of the super expensive getPlugins() or getFunctions()

Jukus
8th March 2021, 20:44
I got some strange BD with almost 100 m2ts files and they are not in chronological order.
Is there any way to parse such a disc for VS?

ChaosKing
8th March 2021, 21:47
Maybe this mpls reader can help https://github.com/HomeOfVapourSynthEvolution/VapourSynth-ReadMpls

videoh
8th March 2021, 22:10
I got some strange BD with almost 100 m2ts files and they are not in chronological order.
Is there any way to parse such a disc for VS? One option: DGDecNV.

BTW, that's not so strange. It's quite common. For example, MONSTERS_UNIVERSITY has 154 M2TS files.

feisty2
11th March 2021, 11:56
it seems that nfNoCache is now the only node flag in API v4, has nfMakeLinear been replaced by std.Cache(make_linear = True)?
are fmFrameState (API v4) and fmSerial (API v3) the same thing?

Myrsloik
11th March 2021, 12:47
it seems that nfNoCache is now the only node flag in API v4, has nfMakeLinear been replaced by std.Cache(make_linear = True)?
are fmFrameState (API v4) and fmSerial (API v3) the same thing?

Yes, you have to add a cache with std.Cache(make_linear = True) yourself. Preferably inside the filter constructor that needs it.

fmFrameState and fmSerial are still separate things.

feisty2
11th March 2021, 13:07
fmFrameState and fmSerial are still separate things.

so fmSerial has been removed in API v4, could you elaborate on how they are different?

Myrsloik
11th March 2021, 13:36
so fmSerial has been removed in API v4, could you elaborate on how they are different?

Never mind, fmFrameState = fmSerial. I renamed it so people won't think it makes frame accesses more linear which is a common confusion.

Selur
13th March 2021, 00:53
Got a question:
In case it use SelectEvery to split a clip into two clips:
clipA = core.std.SelectEvery(clip=clip, cycle=5, offsets=[0 3 4])
clipB = core.std.SelectEvery(clip=clip, cycle=5, offsets=[1 2])
(no frames get lost or are present in both clips)
and apply some additional filters to those clips, how can I weave those two clips properly together again?
Is there some sort of advanced Interleave which I could use with the offsets I used before.

Alternatively: How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?

Cu Selur

Ps.: may be using https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames ?

poisondeathray
13th March 2021, 02:09
Got a question:
In case it use SelectEvery to split a clip into two clips:
clipA = core.std.SelectEvery(clip=clip, cycle=5, offsets=[0 3 4])
clipB = core.std.SelectEvery(clip=clip, cycle=5, offsets=[1 2])
(no frames get lost or are present in both clips)
and apply some additional filters to those clips, how can I weave those two clips properly together again?
Is there some sort of advanced Interleave which I could use with the offsets I used before.

Alternatively: How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?

Cu Selur

Ps.: may be using https://github.com/Irrational-Encoding-Wizardry/Vapoursynth-RemapFrames ?



Or ugly "old fashioned" way


clipA = core.std.SelectEvery(clip, cycle=5, offsets=[0, 3, 4])
clipB = core.std.SelectEvery(clip, cycle=5, offsets=[1, 2])

clipA0 = core.std.SelectEvery(clipA, cycle=3, offsets=[0])
clipA3 = core.std.SelectEvery(clipA, cycle=3, offsets=[1])
clipA4 = core.std.SelectEvery(clipA, cycle=3, offsets=[2])

clipB1 = core.std.SelectEvery(clipB, cycle=2, offsets=[0])
clipB2 = core.std.SelectEvery(clipB, cycle=2, offsets=[1])

int = core.std.Interleave(clips=[clipA0,clipB1,clipB2,clipA3,clipA4])

Selur
13th March 2021, 10:23
Or ugly "old fashioned" way
What's the other alternative? I don't see how I could use RemapFrames for this,...

Cu Selur

feisty2
13th March 2021, 17:08
for any m < n, is it guaranteed that VS will only call getFrame(n, arAllFramesReady) after getFrame(m, arAllFramesReady) has completed for fmParallelRequests, fmUnordered and fmSerial?

Myrsloik
13th March 2021, 23:53
for any m < n, is it guaranteed that VS will only call getFrame(n, arAllFramesReady) after getFrame(m, arAllFramesReady) has completed for fmParallelRequests, fmUnordered and fmSerial?

Nope. There's no api guarantee at all for order. There is however an internal tag that keeps track of the request number and takes it into consideration when scheduling things so most of the time things will be kinda in order.

_Al_
14th March 2021, 02:30
How can I apply a filter only to specific frames which follow a pattern (given by cycle and offsets)?
what comes to mind is to use Python, same as if you'd code something, as if coding in Python
import vapoursynth as vs
from vapoursynth import core
clip = core.std.BlankClip(format=vs.YUV420P8, color =(100,128,128))

def bright(clip):
return clip.std.Expr(["x 40 +","",""])

def dark(clip):
return clip.std.Expr(["x 40 -","",""])

DISTRIBUTE_FILTER = {
0: bright,
1: dark,
2: dark,
3: bright,
4: bright,
}

clip_out = clip.std.FrameEval(lambda n: DISTRIBUTE_FILTER[n % len(DISTRIBUTE_FILTER)](clip))
clip_out.set_output()
to use lambda could be overwhelming so to call a function from FrameEval():

import functools
def distribute_filter(n,clip=clip):
return DISTRIBUTE_FILTER[n % len(DISTRIBUTE_FILTER)](clip)
clip_out = core.std.FrameEval(clip, functools.partial(distribute_filter,clip=clip))

AOmundson
15th March 2021, 01:46
I'm attempting to decomb a video clip using TDeintMod (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-TDeintMod), but it keeps outputting an error that I have no idea how to solve.

Script:
import vapoursynth as vs
core = vs.get_core()
core.max_cache_size = 32768

clip = r'D:\Video\1.mkv' #replace with your video file

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))
combProps = core.tdm.IsCombed(clip)
clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), combProps)

clip.set_output()

Error Message:

2021-03-14 19:43:13.737
Failed to evaluate the script:
Python exception: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 13, in
deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
File "src\cython\vapoursynth.pyx", line 2056, in vapoursynth.Function.__call__
vapoursynth.Error: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

poisondeathray
15th March 2021, 02:13
I'm attempting to decomb a video clip using TDeintMod (https://github.com/HomeOfVapourSynthEvolution/VapourSynth-TDeintMod), but it keeps outputting an error that I have no idea how to solve.

Script:
import vapoursynth as vs
core = vs.get_core()
core.max_cache_size = 32768

clip = r'D:\Video\1.mkv' #replace with your video file

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))
combProps = core.tdm.IsCombed(clip)
clip = core.std.FrameEval(clip, functools.partial(conditionalDeint, orig=clip, deint=deint), combProps)

clip.set_output()

Error Message:

2021-03-14 19:43:13.737
Failed to evaluate the script:
Python exception: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 13, in
deint = core.tdm.TDeintMod(clip, order=1, edeint=core.nnedi3.nnedi3(clip, field=1))
File "src\cython\vapoursynth.pyx", line 2056, in vapoursynth.Function.__call__
vapoursynth.Error: nnedi3: argument clip was passed an unsupported type (expected clip compatible type but got str)


Did you load the video with a source filter?


clip = r'D:\Video\1.mkv' #replace with your video file


should be something like this

clip = core.lsmas.LWLibavSource(r'D:\Video\1.mkv')

AOmundson
15th March 2021, 03:13
Did you load the video with a source filter?


clip = r'D:\Video\1.mkv' #replace with your video file


should be something like this

clip = core.lsmas.LWLibavSource(r'D:\Video\1.mkv')


Thanks, that fixed that error, but I'm currently suffering another one.


2021-03-14 21:12:32.715
Failed to evaluate the script:
Python exception: lsmas: failed to construct index.

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 6, in
clip = core.lsmas.LWLibavSource(clip)
File "src\cython\vapoursynth.pyx", line 2069, in vapoursynth.Function.__call__
vapoursynth.Error: lsmas: failed to construct index.


On that note, would you recommend FFmpeg or LSMASH for de-combing cartoons/anime without creating new combing lines?

poisondeathray
15th March 2021, 03:32
Thanks, that fixed that error, but I'm currently suffering another one.


2021-03-14 21:12:32.715
Failed to evaluate the script:
Python exception: lsmas: failed to construct index.

Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src\cython\vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "E:\VapourSynthEditor\Decomb.vpy", line 6, in
clip = core.lsmas.LWLibavSource(clip)
File "src\cython\vapoursynth.pyx", line 2069, in vapoursynth.Function.__call__
vapoursynth.Error: lsmas: failed to construct index.


On that note, would you recommend FFmpeg or LSMASH for de-combing cartoons/anime without creating new combing lines?


Did you get the path correct ?

Are you using recent LSmash version ?

Personally, I would use neither for a DVD source. DGSource if you have a Nvidia card and license, or DGDecode / d2v.Source are more reliable

AOmundson
15th March 2021, 03:46
Did you get the path correct ?

Are you using recent LSmash version ?

Personally, I would use neither for a DVD source. DGSource if you have a Nvidia card and license, or DGDecode / d2v.Source are more reliable

Thanks, I've got it working now. When you say to use DGSource/DGDecode instead of LSmash/FFmpeg, how would I go about implementing that? i.e. What DLLs would I need to download for the VS plugin folder, how should I write the code line in the editor itself, and what should I place in the Header, Executable, and Arguments boxes?

LessThanJake
19th March 2021, 10:21
I have installed VapourSynth via installer (VapourSynth64-R52.exe (https://github.com/vapoursynth/vapoursynth/releases)).

print(core.version()) for system wide python install says:
VapourSynth Video Processing Library
Copyright (c) 2012-2020 Fredrik Mellbin
Core R52
API R3.6
Options: -

If I create my own environment and add Vapoursynth via "pip install vapoursynth" says:
print(core.version())
VapourSynth Video Processing Library
Copyright (c) 2012-2020 Fredrik Mellbin
Core R51
API R3.6
Options: -

Documentation says:
https://i.imgur.com/CglX0nd.png

If installation via pip requires installation of VapourSynth beforehand I assume it referes to the global install (R52) but it says R51.
So what version do I actually have when using pip in my own env and does it matter that it only shows R51 and can s.o. update PyPi to R52 that it matches again?

Thanks :)

jinkazuya
23rd March 2021, 00:34
I am just wondering how to use the script here https://github.com/Selur/VapoursynthScriptsInHybrid/blob/master/G41Fun.py#L2885
if I use vapoursynth? I do not know what to do with it. Thanks and hope somebody could help. I would like to use the script or plugin of the detailsharpen.

vxzms
23rd March 2021, 01:19
I am just wondering how to use the script here https://github.com/Selur/VapoursynthScriptsInHybrid/blob/master/G41Fun.py#L2885
if I use vapoursynth? I do not know what to do with it. Thanks and hope somebody could help. I would like to use the script or plugin of the detailsharpen.



import vapoursynth as vs
from vapoursynth import core
import G41Fun

src = core.lsmas.LWLibavSource(clip)
dsharped = G41Fun.DetailSharpen(src, z=4, sstr=1.5, power=4, ldmp=1, mode=1, med=False)

dsharped.set_output()

jinkazuya
23rd March 2021, 03:11
import vapoursynth as vs
from vapoursynth import core
import G41Fun

src = core.lsmas.LWLibavSource(clip)
dsharped = G41Fun.DetailSharpen(src, z=4, sstr=1.5, power=4, ldmp=1, mode=1, med=False)

dsharped.set_output()



Thanks but how to use it with staxrip and what is the procedure of using it. Since it is the script of python, I do not know how to use it.

monohouse
23rd March 2021, 05:23
I have some problem with MakeDiff in versions 50,51,52 :x
Script evaluation failed:
Python exception: MakeDiff: both clips must have constant format and dimensions, and the same format and dimensions

Traceback (most recent call last):
File "src/cython/vapoursynth.pyx", line 2244, in vapoursynth.vpy_evaluateScript
File "src/cython/vapoursynth.pyx", line 2245, in vapoursynth.vpy_evaluateScript
File "/mnt/dod/04.vpy", line 11, in <module>
clip = haf.QTGMC(clip, TFF=True, Preset="Placebo", ShowSettings=False, opencl=False, device=0, TR0=2, TR1=2, SourceMatch=0, TR2=0, Lossless=0, Sharpness=0 )
File "/usr/lib/python3.6/site-packages/havsfunc.py", line 1281, in QTGMC
noise = core.std.MakeDiff(clip, denoised, planes=CNplanes)
File "src/cython/vapoursynth.pyx", line 2069, in vapoursynth.Function.__call__
vapoursynth.Error: MakeDiff: both clips must have constant format and dimensions, and the same format and dimensions

linux, all compiled today, used LD_PRELOAD to test for plugin errors and there are none, without QTGMC the script works, latest mvsfunc and havsfunc

import vapoursynth as vs
import havsfunc as haf

core = vs.get_core()
core.set_max_cache_size(16000)

clip = core.ffms2.Source("//mnt//dod//movie.mkv")
clip = core.fmtc.bitdepth (clip, bits=16, fulls=False, fulld=True, dmode=1)
clip = haf.QTGMC(clip, TFF=True, Preset="Placebo", ShowSettings=False, opencl=False, device=0, TR0=2, TR1=2, SourceMatch=0, TR2=0, Lossless=0, Sharpness=0 )
clip = haf.MCTemporalDenoise(clip, radius=3, limit=2, twopass=False, limit2=2, refine=True, useTTmpSm=True, stabilize=False, maxr=3, TTstr=3, chroma=False, MVsharp=False, sigma=0, pfMode=-1,search=3, searchparam=4, pel=4, pelsearch=4, bwbh=512, owoh=256, blksize=4, overlap=2, deblock=False, post=0,bt=4,thSAD=2000, thSAD2=2000, thSCD1=1000, thSCD2=200)
clip = core.deblock.Deblock(clip, quant=20, aoffset=0, boffset=0)
clip = core.fmtc.bitdepth (clip, bits=10, fulls=True, fulld=True, dmode=1)
clip.set_output()

tested several older versions of havsfunc no change :x
I removed this code from src/core/mergefilters.c and it started working fine and the video looks correct
if (!isConstantFormat(d.vi) || !isSameFormat(d.vi, vsapi->getVideoInfo(d.node2))) {
vsapi->freeNode(d.node1);
vsapi->freeNode(d.node2);
RETERROR("MakeDiff: both clips must have constant format and dimensions, and the same format and dimensions");
}

strange problem

LigH
23rd March 2021, 15:02
Thanks but how to use it with staxrip and what is the procedure of using it. Since it is the script of python, I do not know how to use it.

First a question to stax76 ... does StaxRip support VapourSynth filters at all, as selectable filter? Probably not easily, because StaxRip builds AviSynth scripts. I don't think you can simply mix both worlds.

Or maybe I'm wrong. I noticed that StaxRip x64 ships both frameservers. But how to select either or mix both, may be better asked in his own thread about StaxRip (https://forum.doom9.org/showthread.php?t=172068).

stax76
23rd March 2021, 16:15
@LigH

I've expected a little more competence from somebody like you ... , right-click filters and choose:

Filter Setup > VapourSynth

After that:

File > Save Project As Template > Load template on startup

Vapoursynth is now your default frame server ready to use in staxrip, it currently has 60 vapoursynth plugins included, most of them with presets available in an easy-to-use menu.

https://github.com/staxrip/staxrip/wiki/Tools

jinkazuya
23rd March 2021, 17:46
@LigH

I've expected a little more competence from somebody like you ... , right-click filters and choose:

Filter Setup > VapourSynth

After that:

File > Save Project As Template > Load template on startup

Vapoursynth is now your default frame server ready to use in staxrip, it currently has 60 vapoursynth plugins included, most of them with presets available in an easy-to-use menu.

https://github.com/staxrip/staxrip/wiki/Tools

Hi stax76, would that be ok for you to include the plugin for Detailsharpen in the future release? I greatly appreciate. Staxrip is a pretty good application or program but I used to use MEGUI and now MEGUI and Avisynth+ become a bit complicated and none of the script that I used work and the encoding always throw exception when it is halfway done. But using scripts with staxrip is a little bit complicated to newbies or beginners. I hope staxrip could integrate a bit more plugins by default in the future esp I would like to use my beloved detailsharpen. Thanks a lot.

ChaosKing
23rd March 2021, 17:55
It seems it is aready included https://github.com/staxrip/staxrip/wiki/Tools#g41fun