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 15th March 2021, 03:46   #4241  |  Link
AOmundson
Registered User
 
Join Date: Dec 2017
Posts: 15
Quote:
Originally Posted by poisondeathray View Post
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?
AOmundson is offline   Reply With Quote
Old 19th March 2021, 10:21   #4242  |  Link
LessThanJake
Registered User
 
Join Date: Sep 2007
Posts: 31
pip install has different version

I have installed VapourSynth via installer (VapourSynth64-R52.exe).

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:


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
LessThanJake is offline   Reply With Quote
Old 23rd March 2021, 00:34   #4243  |  Link
jinkazuya
Registered User
 
Join Date: Jul 2010
Posts: 114
I am just wondering how to use the script here https://github.com/Selur/Vapoursynth...41Fun.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.
jinkazuya is offline   Reply With Quote
Old 23rd March 2021, 01:19   #4244  |  Link
vxzms
Registered User
 
Join Date: Nov 2018
Posts: 11
Quote:
Originally Posted by jinkazuya View Post
I am just wondering how to use the script here https://github.com/Selur/Vapoursynth...41Fun.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.
Code:
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()
vxzms is offline   Reply With Quote
Old 23rd March 2021, 03:11   #4245  |  Link
jinkazuya
Registered User
 
Join Date: Jul 2010
Posts: 114
Quote:
Originally Posted by vxzms View Post
Code:
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.
jinkazuya is offline   Reply With Quote
Old 23rd March 2021, 05:23   #4246  |  Link
monohouse
Registered User
 
Join Date: Jul 2007
Posts: 106
I have some problem with MakeDiff in versions 50,51,52 :x
Code:
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

Code:
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
Code:
    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

Last edited by monohouse; 23rd March 2021 at 06:16.
monohouse is offline   Reply With Quote
Old 23rd March 2021, 15:02   #4247  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,781
Quote:
Originally Posted by jinkazuya View Post
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.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 23rd March 2021 at 15:34.
LigH is offline   Reply With Quote
Old 23rd March 2021, 16:15   #4248  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@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

Last edited by stax76; 23rd March 2021 at 16:26.
stax76 is offline   Reply With Quote
Old 23rd March 2021, 17:46   #4249  |  Link
jinkazuya
Registered User
 
Join Date: Jul 2010
Posts: 114
Quote:
Originally Posted by stax76 View Post
@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.
jinkazuya is offline   Reply With Quote
Old 23rd March 2021, 17:55   #4250  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
It seems it is aready included https://github.com/staxrip/staxrip/wiki/Tools#g41fun
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 23rd March 2021, 18:37   #4251  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@jinkazuya

Yes, it appears it was included by an ex maintainer, but it might not be available in the menu, for that there is documentation here:

https://github.com/staxrip/staxrip/w...deo-processing

https://github.com/staxrip/staxrip/w...%29-in-StaxRip
stax76 is offline   Reply With Quote
Old 23rd March 2021, 20:43   #4252  |  Link
jinkazuya
Registered User
 
Join Date: Jul 2010
Posts: 114
Quote:
Originally Posted by ChaosKing View Post
Quote:
Originally Posted by stax76 View Post
@jinkazuya

Yes, it appears it was included by an ex maintainer, but it might not be available in the menu, for that there is documentation here:

https://github.com/staxrip/staxrip/w...deo-processing

https://github.com/staxrip/staxrip/w...%29-in-StaxRip
The github page does not exist anymore for the plugin or script of detailsharpen, which is why if possible, if the plugin is included in the menu in the future release, that would be awesome.
jinkazuya is offline   Reply With Quote
Old 23rd March 2021, 22:54   #4253  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
@jinkazuya

Please create a new thread (or use the staxrip thread) asking for code and default values and then add this code and values to the following wiki page:

Tool Update Requests

Last edited by stax76; 23rd March 2021 at 22:57.
stax76 is offline   Reply With Quote
Old 24th March 2021, 13:01   #4254  |  Link
jackoneill
unsigned int
 
jackoneill's Avatar
 
Join Date: Oct 2012
Location: 🇪🇺
Posts: 760
Quote:
Originally Posted by monohouse View Post
I have some problem with MakeDiff in versions 50,51,52 :x
Code:
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

Code:
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
Code:
    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
The error message gives you the line number in havsfunc.py (1281), so right before that line add
Code:
print(clip)
print(denoised)
to see what the difference is between those clips.
__________________
Buy me a "coffee" and/or hire me to write code!
jackoneill is offline   Reply With Quote
Old 27th March 2021, 00:50   #4255  |  Link
Patman
Registered User
 
Patman's Avatar
 
Join Date: Jan 2015
Posts: 286
Hello everybody. I need your help with the following problem:

I have this code in my avs.c:

Code:
    h->bit_depth = h->func.avs_bits_per_component(vi);
    FAIL_IF_ERROR( h->bit_depth < 8 || h->bit_depth > 16, "unsupported bit depth `%d'\n", h->bit_depth );
    if( h->bit_depth & 7 )
    {
        AVS_Value arg_arr[2];
        arg_arr[0] = res;
        arg_arr[1] = avs_new_value_int( 16 );
        const char *arg_name[] = { NULL, "bits" };
        AVS_Value res2 = h->func.avs_invoke( h->env, "ConvertBits", avs_new_value_array( arg_arr, 2 ), arg_name );
        FAIL_IF_ERROR( avs_is_error( res2 ), "couldn't convert to 16 bits: %s\n", avs_as_error( res2 ) );
        res = update_clip( h, &vi, res2, res );
    }
I would now like to store a code with an identical function in my vpy.c, but unfortunately it doesn't work that well. I have the following approach:

Code:
    h->bit_depth = vi->format->bitsPerSample;
    FAIL_IF_ERROR( h->bit_depth < 8 || h->bit_depth > 16, "unsupported bit depth `%d'\n", h->bit_depth );
    FAIL_IF_ERROR( vi->format->sampleType == stFloat, "unsupported sample type `float'\n" );
    if (h->bit_depth & 7)
    {
        VSMap* args = h->vsapi->createMap();
        const char* error;
        VSPlugin* fmtcPlugin = h->vsapi->getPluginById("fmtconv", core);

        h->vsapi->propSetNode(args, "clip", h->node, paReplace);
        h->vsapi->freeNode(h->node);
        const VSFormat* new_format = h->vsapi->registerFormat(vi->format->colorFamily, vi->format->sampleType, 16, vi->format->subSamplingW, vi->format->subSamplingH, core);
        h->vsapi->propSetInt(args, "csp", new_format->id, paReplace);
        VSMap* ret = h->vsapi->invoke(fmtcPlugin, "bitdepth", args);
        error = h->vsapi->getError(ret);
        if (error)
        {
            FAIL_IF_ERROR(1, "failed to convert node to 16 bits: `%s'\n", error);
            h->vsapi->freeMap(args);
            h->vsapi->freeMap(ret);
            return -1;
        }
        h->node = h->vsapi->propGetNode(ret, "clip", 0, NULL);
        h->vsapi->freeMap(ret);
    }
The aim is to consider certain plugins when processing. With avs it is 'ConvertBits' and with vpy 'fmtconv'. Does somebody has any idea?
__________________
Tools for StaxRip | x264 - x265

Last edited by Patman; 27th March 2021 at 12:27.
Patman is offline   Reply With Quote
Old 27th March 2021, 06:00   #4256  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
if you have a C++20 compiler (I guess GCC11 is currently the only option), you can play with my C++ wrapper for VS API and coding a plugin is no more complicated than python scripting.

if you need to invoke an external filter as some sort of preprocessing, you can do it directly in the constructor of the filter
Code:
MyFilter(auto Arguments, auto Core) {
    auto PreprocessedClip = Core["fmtc"]["bitdepth"]("clip", Arguments["clip"], "bits", 16);
}
alternatively, you can define InitiateCallGraph() if you need to run a more complex filter sequence, where you can invoke external filters for postprocessing, or recursively invoke the filter that is being defined.
feisty2 is offline   Reply With Quote
Old 27th March 2021, 06:17   #4257  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
and no error checking of any sort is required (unless you need to change how your filter behaves based on if an evaluation fails), the error message (plugin not found, evaluation failed, or whatever) will automatically propagate to the console (vsedit, vspipe, etc.)
feisty2 is offline   Reply With Quote
Old 27th March 2021, 10:13   #4258  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 377
Since it's about x264, it uses C compiler, not C++.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 27th March 2021, 11:09   #4259  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
He/She didn't mention what it is that he/she's working on so I wouldn't have known. and since x264 already relies on GCC, it should be pretty handy for him/her to use the C++ wrapper (C99, the standard that x264 seems to be using, is mostly a subset of C++20 after all).
feisty2 is offline   Reply With Quote
Old 27th March 2021, 14:05   #4260  |  Link
Patman
Registered User
 
Patman's Avatar
 
Join Date: Jan 2015
Posts: 286
I'll give your wrapper a try.

As DJATOM already mentioned, the files are written in C (C compiler) and are used to directly support avs / vpy scripts in x264.
__________________
Tools for StaxRip | x264 - x265

Last edited by Patman; 27th March 2021 at 14:10.
Patman 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 05:35.


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