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, 00:37   #4541  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 70
Quote:
Originally Posted by Yomiko View Post
What's the reason for not allowing a GRAY plane extracted from an RGB clip resized to RGB because of its tagged matrix? It seems the matrix itself (if supported by VS) doesn't affect the output result.
Meanwhile GRAY clip with unspec matrix can be resampled. A bug?
Yomiko is offline   Reply With Quote
Old 25th October 2021, 10:41   #4542  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by Yomiko View Post
Meanwhile GRAY clip with unspec matrix can be resampled. A bug?
No, gray clips are the Y in YUV so the same rules apply. You can resize unknown matrix YUV but you can't convert it to RGB.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th October 2021, 14:11   #4543  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,775
I'm on Ubuntu 20.04, I compiled and installed Vapoursynth R57.
I also compiled a bunch of filters to "/home/selur/opt/vapoursynth/lib/python3.8/site-packages"

paths seem to be correct:
Code:
echo $LD_LIBRARY_PATH
/home/selur/opt/vapoursynth/lib
echo $PYTHONPATH
/home/selur/opt/vapoursynth/lib/python3.8/site-packages
echo $PATH
/home/selur/.local/bin:/home/selur/opt/vapoursynth/bin:/home/selur/.local/bin:/home/selur/opt/vapoursynth/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
Code:
import vapoursynth as vs
core = vs.core
clip = core.std.BlankClip(format=vs.RGB24, color=[255, 255, 255])
clip = core.text.Text(clip, core.version())
clip.set_output()
works fine

explicit loading a library (libvslsmashsource.so):
Code:
import vapoursynth as vs
core = vs.core

core.std.LoadPlugin('/home/selur/opt/vapoursynth/lib/vapoursynth/libvslsmashsource.so')

clip = core.lsmas.LWLibavSource(source="test.mov", format="YUV422P10", cache=0, fpsnum=30000, fpsden=1001, prefer_hw=0)
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")

clip.set_output()
works fine too,

but using:
Code:
import sys
import vapoursynth as vs
core = vs.core

sys.path.append('/home/selur/opt/vapoursynth/lib/vapoursynth')

clip = core.lsmas.LWLibavSource(source="test.mov", format="YUV422P10", cache=0, fpsnum=30000, fpsden=1001, prefer_hw=0)
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")

clip.set_output()
doesn't.
It returns "Python exception: No attribute with the name lsmas exists. Did you mistype a plugin namespace?"

-> How can I tell Vapoursynth where to look for the libraries?
I though:
Code:
sys.path.append('/home/selur/opt/vapoursynth/lib/vapoursynth')
would do the trick, which it doesn't.

Cu Selur
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 25th October 2021, 14:13   #4544  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
You're specifying the python search path, it's only used for import and similar python commands. You also shouldn't install filters in site-packages.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 25th October 2021, 14:18   #4545  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,775
Sorry, my mistake. Didn't put the iflters in the site-packages.
site-packages only contains vapoursynth.la and vapoursynth.so
all compiled filters are in "/home/selur/opt/vapoursynth/lib/vapoursynth/"

Okay, so is there a way to somehow to use my folder as "/home/selur/opt/vapoursynth/lib/vapoursynth/" source for autoloading?
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 25th October 2021, 14:25   #4546  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,775
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
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 25th October 2021, 14:39   #4547  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 70
Also this -> http://www.vapoursynth.com/doc/funct...llplugins.html
Yomiko is offline   Reply With Quote
Old 25th October 2021, 14:56   #4548  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,775
Uhhh,.. didn't know "LoadAllPlugins"
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 25th October 2021, 16:21   #4549  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 251
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   #4550  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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   #4551  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
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 offline   Reply With Quote
Old 26th October 2021, 23:46   #4552  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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   #4553  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 376
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   #4554  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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   #4555  |  Link
WolframRhodium
Registered User
 
Join Date: Jan 2016
Posts: 155
vsh_yourCalledFunction
WolframRhodium is offline   Reply With Quote
Old 27th October 2021, 06:16   #4556  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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   #4557  |  Link
Yomiko
Registered User
 
Join Date: Aug 2021
Posts: 70
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   #4558  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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   #4559  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
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 offline   Reply With Quote
Old 28th October 2021, 08:31   #4560  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
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
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 08:10.


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