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 10th February 2020, 19:01   #3741  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by stax76 View Post
Hello Myrsloik, I've some questions...

Is there some documentation or sample code for DLL discovery and loading?

Do all setup variants add VS to the Path env var and apps can rely on that?

Do all setup variants register the VS location in the registry? If so which key(s)?

I believe Load-Time Dynamic Linking is possible and preferred, I'm mostly unsure about path discovery.
Is there some documentation or sample code for DLL discovery and loading?
No. You read the location you need from the registry. HKLM/HKCU (depends on current user install mode) and then software\vapoursynth (or vapoursynth-32 for poor people) and the keys of interest are called VSScriptDLL and VapourSynthDLL. Simply use loadlibrary and call vsscript_getVSApi2() or getVapourSynthAPI() depending on which dll you use.

Do all setup variants add VS to the Path env var and apps can rely on that?
No. It's a user option and you can never depend on this.

Do all setup variants register the VS location in the registry? If so which key(s)?
Yes, see above. I guess portable doesn't but that's hardly a setup variant...
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 22nd February 2020, 17:19   #3742  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,799
Made some simple wrapper library for AviSynth and VapourSynth, it was necessary because AviSynth has no C or COM interface...

https://github.com/staxrip/staxrip/t...er/FrameServer

https://github.com/staxrip/staxrip/b...FrameServer.vb

https://github.com/staxrip/staxrip/b...deoRenderer.vb
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 23rd February 2020, 05:00   #3743  |  Link
amichaelt
Guest
 
Posts: n/a
Quote:
Originally Posted by stax76 View Post
it was necessary because AviSynth has no C or COM interface...
What about avisynth_c.h?
  Reply With Quote
Old 23rd February 2020, 06:26   #3744  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,799
I don't know, maybe I should try it, sample code would help. When I started the library I didn't know a lot about C/C++ (last project more than 10 years ago) and AviSynth, after completing it I know a little more. With the AviSynth part I had few issues, no problems with VapourSynth.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More
stax76 is offline   Reply With Quote
Old 23rd February 2020, 14:50   #3745  |  Link
DJATOM
Registered User
 
DJATOM's Avatar
 
Join Date: Sep 2010
Location: Ukraine, Bohuslav
Posts: 376
The way you're using frame fetching in VS is inefficient. In general you have to care about async frame requests on your end, otherwise it works like a single-threaded frameserver.
__________________
Me on GitHub
PC Specs: Ryzen 5950X, 64 GB RAM, RTX 2070
DJATOM is offline   Reply With Quote
Old 23rd February 2020, 21:13   #3746  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by amichaelt View Post
What about avisynth_c.h?
Using the avisynth C api is really iffy. If all you want is to evaluate a script and get frames out then writing your own C++ wrapper dll will be so much more reliable and also faster. Believe me, I've tried both ways long ago when developing yatta.

VapourSynth has a very straightforward C-api in comparison.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 23rd February 2020, 23:18   #3747  |  Link
_Al_
Registered User
 
Join Date: May 2011
Posts: 251
If trying to modify props and clip resolution is ridiculously small, it crashes, where no recovery is possible, it locks a PC.

Code:
rgb  = core.std.BlankClip(width=30, height=16, format=vs.RGB24)
rgb2 = rgb.std.PlaneStats(prop='PlaneStats')
PROP_NAME  = f'New_string_name_here'
def copy_prop(n,f):
   f_out = f[0].copy()
   f_out.props[PROP_NAME] = '{:.1f}'.format(f[1].props['PlaneStatsAverage']*100)
   return f_out
rgb = core.std.ModifyFrame(rgb, [rgb, rgb2], copy_prop)

Last edited by _Al_; 23rd February 2020 at 23:20.
_Al_ is offline   Reply With Quote
Old 24th February 2020, 00:31   #3748  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,799
Quote:
Originally Posted by DJATOM View Post
The way you're using frame fetching in VS is inefficient. In general you have to care about async frame requests on your end, otherwise it works like a single-threaded frameserver.
For a GUI like staxrip it's totally fine, it's not used for encoding but only to access parameters and for a basic crop and preview dialog that doesn't support playback and HDR color handling but has mpv/mpc integration to take care of this. The GDI based WinForms rendering was ridiculously slow but it was addressed with a hardware accelerated Direct2D replacement. It does a vertical flip and converts to RGB32 in software via avs/vs. For best possible performance vertical flip and YV12 could be handled by Direct3D and like you told frames could be accessed asynchronously.
__________________
mpv.net - StaxRip - MediaInfo.NET - Get-MediaInfo - More

Last edited by stax76; 24th February 2020 at 00:46.
stax76 is offline   Reply With Quote
Old 29th February 2020, 15:22   #3749  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by _Al_ View Post
If trying to modify props and clip resolution is ridiculously small, it crashes, where no recovery is possible, it locks a PC.

Code:
rgb  = core.std.BlankClip(width=30, height=16, format=vs.RGB24)
rgb2 = rgb.std.PlaneStats(prop='PlaneStats')
PROP_NAME  = f'New_string_name_here'
def copy_prop(n,f):
   f_out = f[0].copy()
   f_out.props[PROP_NAME] = '{:.1f}'.format(f[1].props['PlaneStatsAverage']*100)
   return f_out
rgb = core.std.ModifyFrame(rgb, [rgb, rgb2], copy_prop)
I can't reproduce this and need more information. CPU? OS? Number of threads? Does it happen every time?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 1st March 2020, 00:02   #3750  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
R49-RC1 is now available. All maintenance this time since I'm slowly working on the separate audio build.

Changes:
Code:
r49:
updated to python 3.8 on windows
updated visual studio 2019 runtime version
updated zimg and added support for spline64 resize method
fixed a savestring bug in avscompat (sekrit-twc)
interleave, selectevery and separate fields now have a modify_duration argument to determine if they modify frame durations and fps
addborders and crop now update the _fieldbased attribute properly when an odd number of lines are cut from the top
fixed add to path not working for single user installs
fixed compilation on non-x86 systems
fixed an infinite loop in the expr filter optimizer that was introduced in r48 (sekrit-twc)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 3rd March 2020, 07:44   #3751  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
I don't know if this is a bug from vapoursynth or KNLMeansCL. KNLMeansCL requires input clip to be YUV444P10, but it still complains about it when I converted my clip to YUV444P10.

Code:
clip = core.resize.Bicubic(clip, format=vs.YUV444P10)
clip = core.knlm.KNLMeansCL(clip)
But then it works when I convert it to YUV444P8
lansing is offline   Reply With Quote
Old 4th March 2020, 19:31   #3752  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,775
@lansing: read https://github.com/Khanattila/KNLMeansCL/issues/42
__________________
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 4th March 2020, 20:31   #3753  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,616
Quote:
Originally Posted by Selur View Post
Thanks, I'll follow up over there.
lansing is offline   Reply With Quote
Old 19th March 2020, 21:21   #3754  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
R49-RC2 is out. Should be the final RC.

Code:
r49:
updated to python 3.8 on windows
updated visual studio 2019 runtime version
updated zimg and added support for spline64 resize method
fixed transfer characteristics not being applied to gray format clips (sekrit-twc)
fixed vdecimate bugs when compiled on systems where char is unsigned by default
fixed a regression introduced in r48 in that could sometimes cause corrupt output from expr on cpus without sse4.1 (sekrit-twc)
fixed a savestring bug in avscompat (sekrit-twc)
interleave, selectevery and separate fields now have a modify_duration argument to determine if they modify frame durations and fps
addborders and crop now update the _fieldbased attribute properly when an odd number of lines are cut from the top
fixed add to path not working for single user installs
fixed compilation on non-x86 systems
fixed an infinite loop in the expr filter optimizer that was introduced in r48 (sekrit-twc)
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 24th March 2020, 16:17   #3755  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 4,988
Can 2 python versions 3.x coexist ? 3.7.x and 3.8.x ? I ask because I need 3.7 for some other projects but would like to test new version of vapoursynth, and I'm assuming 3.8 is a requirement for r49-rc2 ?
poisondeathray is offline   Reply With Quote
Old 24th March 2020, 16:30   #3756  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by poisondeathray View Post
Can 2 python versions 3.x coexist ? 3.7.x and 3.8.x ? I ask because I need 3.7 for some other projects but would like to test new version of vapoursynth, and I'm assuming 3.8 is a requirement for r49-rc2 ?
Yes, they can generally do that without any problems. However the python installer doesn't approve so you'll need to rename/delete the registry entries for the version you install first.

There's also always the portable version. Maybe that's easier.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 25th March 2020, 07:33   #3757  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
@Myrsloik
Code:
auto y1 = vsapi->getReadPtr(x, 0);

auto x2 = vsapi->cloneFrameRef(x);
auto y2 = vsapi->getReadPtr(x2, 0);
say "x" is a frame ref, do "y1" and "y2" evaluate to the same value?
feisty2 is offline   Reply With Quote
Old 25th March 2020, 09:05   #3758  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by feisty2 View Post
@Myrsloik
Code:
auto y1 = vsapi->getReadPtr(x, 0);

auto x2 = vsapi->cloneFrameRef(x);
auto y2 = vsapi->getReadPtr(x2, 0);
say "x" is a frame ref, do "y1" and "y2" evaluate to the same value?
Yes, they point to the same underlying frame.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is online now   Reply With Quote
Old 26th March 2020, 14:58   #3759  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
what is the lifetime of "in" and "out" in the "Create" function? If I create an std::string_view from propGetData(in, ...), does it have a global lifetime?
feisty2 is offline   Reply With Quote
Old 26th March 2020, 15:25   #3760  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,493
Quote:
Originally Posted by feisty2 View Post
what is the lifetime of "in" and "out" in the "Create" function? If I create an std::string_view from propGetData(in, ...), does it have a global lifetime?
They're only valid inside the create function and usually destroyed very quickly after.
__________________
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 14:17.


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