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

Reply
 
Thread Tools Search this Thread Display Modes
Old 25th October 2021, 14:25   #4541  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
okay, forget it found it.
"$HOME/.config/vapoursynth/vapoursynth.conf "
with:
"SystemPluginDir=/home/selur/opt/vapoursynth/lib/vapoursynth"
works
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 25th October 2021, 14:39   #4542  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 73
Also this -> http://www.vapoursynth.com/doc/funct...llplugins.html
Yomiko is offline   Reply With Quote
Old 25th October 2021, 14:56   #4543  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 7,259
Uhhh,.. didn't know "LoadAllPlugins"
__________________
Hybrid here in the forum, homepage
Selur is offline   Reply With Quote
Old 25th October 2021, 16:21   #4544  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 321
oh, was LoadAllPlugins introduced with new API release or does it work with older releases too?
_Al_ is offline   Reply With Quote
Old 26th October 2021, 06:03   #4545  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
When creating filter, where do we put the xyvInit() initial function in API4 now? It was gone in the example filter. And in the createVideoFilter(), there are this two lines in the example script:

Code:
VSFilterDependency deps[] = {{d.node, rpStrictSpatial}};
vsapi->createVideoFilter(out, "Invert", vi, invertGetFrame, invertFree, fmParallel, deps, 1, data, core);
What is the VSFilterDependency and numDeps do? The documentation is lacking.
lansing is offline   Reply With Quote
Old 26th October 2021, 10:27   #4546  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
When creating filter, where do we put the xyvInit() initial function in API4 now? It was gone in the example filter. And in the createVideoFilter(), there are this two lines in the example script:

Code:
VSFilterDependency deps[] = {{d.node, rpStrictSpatial}};
vsapi->createVideoFilter(out, "Invert", vi, invertGetFrame, invertFree, fmParallel, deps, 1, data, core);
What is the VSFilterDependency and numDeps do? The documentation is lacking.
1. You have a function that calls createVideoFilter(), put it there instead. Most filters are already written that way.

2. It's an array where you list all the nodes and in which order you will request frames from them to generate the output. StrictSpatial is obviously for spatial only filters, NoFrameReuse is for reordering filters of certain types (basically if you request all output frames once none of the input frames will be requested twice, trim, splice and similar fit into this category). General is for everything else.

NumDeps is simply how items are in the deps array.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 26th October 2021, 23:46   #4547  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Okay got it. Also can you add some example filter written in c++? Because when I got stuck with the c syntax, I couldn't find any other example because everybody was writing in c++. For example, I want to use the isConstantVideoFormat() from the VSHelper4.h, I included the header file in my c file #include "VSHelper4.h", but visual studio still couldn't recognize the function.
lansing is offline   Reply With Quote
Old 27th October 2021, 00:08   #4548  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Use vsh::yourCalledFunction.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 27th October 2021, 01:33   #4549  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by DJATOM View Post
Use vsh::yourCalledFunction.
using namespace is a c++ thing
lansing is offline   Reply With Quote
Old 27th October 2021, 04:26   #4550  |  Link
WolframRhodium
Registered User
 
Join Date: Jan 2016
Posts: 162
vsh_yourCalledFunction
WolframRhodium is offline   Reply With Quote
Old 27th October 2021, 06:16   #4551  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Thanks, worked.

Now I ran into another problem trying to build the filter. The build succeeded, but the function didn't get register. Here is the xxxCreate function.

Code:
void VS_CC levelsCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) {
    LevelsData d;
    LevelsData *data;
    int err;

    d.node = vsapi->mapGetNode(in, "clip", 0, 0);
    d.vi = *vsapi->getVideoInfo(d.node);

    d.factor = vsapi->mapGetFloat(in, "factor", 0, &err);
    if (err) {
        d.factor = 100.0;
    }

    // Comparing them directly?
    if (d.factor < 0.0 || d.factor > 100.0) {
        vsapi->mapSetError(out, "Levels: factor must be between 0 and 100 (inclusive)");
        vsapi->freeNode(d.node);
        return;
    }

    if (!vsh_isConstantVideoFormat(&d.vi) || d.vi.format.sampleType != stInteger || d.vi.format.bitsPerSample != 8) {
        vsapi->mapSetError(out, "Levels: only constant format 8bit integer input supported");
        vsapi->freeNode(d.node);
        return;
    }

    if (d.vi.width)
        d.vi.width += 256;
    if (d.vi.height)
        d.vi.height = MAX(256, d.vi.height);

    data = (LevelsData *)malloc(sizeof(d));
    *data = d;

    VSFilterDependency deps[] = { {d.node, rpStrictSpatial} };
    vsapi->createVideoFilter(out, "Levels", &d.vi, levelsGetFrame, levelsFree, fmParallel, deps, 1, data, core);
}

########################################

void VS_CC levelsCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi);

VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin* plugin, const VSPLUGINAPI* vspapi) {
    vspapi->configPlugin("com.nodame.histogram", "hist", "VapourSynth Histogram Plugin", VS_MAKE_VERSION(1, 0), VAPOURSYNTH_API_VERSION, 1, plugin);
    vspapi->registerFunction("Levels", "clip:clip;factor:float:opt;", "clip:vnode;", levelsCreate, NULL, plugin);
}
vsedit2 was able to read the plugin "hist", but not the function "Levels". What am I doing wrong?
lansing is offline   Reply With Quote
Old 27th October 2021, 07:05   #4552  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 73
Maybe clip:vnode in the signature.
But if the filter is only for vsedit2, I think having createVideoFilter(2) called in the filter chain should be sufficient.
Yomiko is offline   Reply With Quote
Old 27th October 2021, 07:44   #4553  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Yomiko View Post
Maybe clip:vnode in the signature.
Thank you, that is the problem. I was looking at the codes for hours and couldn't figure it out.
lansing is offline   Reply With Quote
Old 27th October 2021, 11:37   #4554  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Protip: if you misuse the api you'll get warnings for things like invalid argument strings if you run things from the commandline
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 28th October 2021, 08:31   #4555  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Myrsloik View Post
Protip: if you misuse the api you'll get warnings for things like invalid argument strings if you run things from the commandline
What about debugging crashes. My test filter tested okay on vspipe --info but crashes on preview, what do I do?
lansing is offline   Reply With Quote
Old 28th October 2021, 12:23   #4556  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
What about debugging crashes. My test filter tested okay on vspipe --info but crashes on preview, what do I do?
Attach a debugger, duh. If there's no error message then your own code crashed inside the getframe function.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 28th October 2021, 17:26   #4557  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
I want to rotate the frame inside the filter, can I call like std.Transpose and std.FlipHorizontal in the filter?
lansing is offline   Reply With Quote
Old 28th October 2021, 17:49   #4558  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
I want to rotate the frame inside the filter, can I call like std.Transpose and std.FlipHorizontal in the filter?
Yes, use invoke. You can look at the code of SCDetect on how to do it here:
https://github.com/vapoursynth/vs-mi...lters.cpp#L132
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 28th October 2021, 21:58   #4559  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Myrsloik View Post
Yes, use invoke. You can look at the code of SCDetect on how to do it here:
https://github.com/vapoursynth/vs-mi...lters.cpp#L132
What if I want to do rotate right -> process the frame -> rotate left? It feels like doing the last rotate in the xxxFree function is too late in the process?

Last edited by lansing; 28th October 2021 at 22:19.
lansing is offline   Reply With Quote
Old 28th October 2021, 22:54   #4560  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by lansing View Post
What if I want to do rotate right -> process the frame -> rotate left? It feels like doing the last rotate in the xxxFree function is too late in the process?
Use createVideoFilter2() and then simply call invoke on the node returned from there. Same idea.

Not the best example but few places do this in the VS code (see unpackRGB32Create):
https://github.com/vapoursynth/vapou...ompat.cpp#L897
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Reply

Tags
speed, vaporware, vapoursynth

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 10:59.


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