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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th October 2016, 03:29   #1  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
Help with writing Avisynth Plugins

I am just starting to get into writing Avisynth plugins but got stuck right at the beginning in this guide.

Under the "Compiling Your First Plugin" section, it says:
Quote:
Copy (C:\Program Files\ or other installation directory then AviSynth 2.5\Extras\avisynth.lib to demosaic\lib
However, there doesn't seem to be any such file anywhere in my Avisynth+ installation folder.

I am using Avisynth+ r2173.
blaze077 is offline   Reply With Quote
Old 30th October 2016, 04:24   #2  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
If you didn't choose to install the SDK when you installed AviSynth+, then those files won't be there.

And because it's gnawing at my brain like a parasite, the section of that guide that talks about licensing is false. The 2.6 (and Plus) C API does not and never has required plugins written with them be released under the GPL. You can use whatever license you like for the plugin, the exception is there in avisynth_c.h and was not removed at any point between 2.5 and 2.6 (unlike the C++ header, but even it had the exception restored when 2.6 Final was released).
qyot27 is offline   Reply With Quote
Old 30th October 2016, 05:19   #3  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
Will keep the licensing thing in mind.

As for the SDK, I just redid the installation with the FilterSDK option enabled and I still do not have an avisynth.lib file anywhere in the installation folder. I have the avisynth_c.h like before.
blaze077 is offline   Reply With Quote
Old 30th October 2016, 06:14   #4  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
Looks like Groucho2004 didn't include the dev files in the install package for that build.

To be fair, if you're looking at building the plugins, you might want to start by building AviSynth+ itself to get a feel for it*. And if you do that, the .lib files will get built.

A guide is in the AviSynth+ source:
https://github.com/AviSynth/AviSynth...ng_avsplus.rst

The only thing that requires mentioning is that after cloning it, you'll want to checkout the MT branch to get the correct updates. Or you can do the checkout at the same time as the clone:
Code:
git clone -b MT git://github.com/AviSynth/AviSynthPlus.git
qyot27 is offline   Reply With Quote
Old 30th October 2016, 06:17   #5  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
Thank you. I will try that out tomorrow.
blaze077 is offline   Reply With Quote
Old 30th October 2016, 10:42   #6  |  Link
Groucho2004
 
Groucho2004's Avatar
 
Join Date: Mar 2006
Posts: 3,960
Quote:
Originally Posted by qyot27 View Post
Looks like Groucho2004 didn't include the dev files in the install package for that build.
What dev files? The AVS+ installer script only includes help files if "Filter SDK" is selected.

Edit: The "official" 2.6 Avisynth installer does offer the option to install the C-header and avisynth.lib.

Last edited by Groucho2004; 30th October 2016 at 11:26.
Groucho2004 is offline   Reply With Quote
Old 30th October 2016, 17:24   #7  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
Actually yeah, now that I think of it, I don't think I'd ever tried installing the AviSynth+ SDK files from the InnoSetup-based installer. I must have been confusing it with the old installer.

Part of why it's not in the new installer is probably the stance that 'AviSynth+ should be supported in your program by using dynamic loading', and that doesn't need the *.lib files. For plugins that gets kind of hairy, though - not saying it can't be done, just that it's somewhat arcane (the FFMS2 C-plugin does it, but I haven't gotten it updated to use AviSynth+'s headers yet).
qyot27 is offline   Reply With Quote
Old 31st October 2016, 22:58   #8  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
I somehow managed to reach the Building Avisynth section of the guide through trial and error and whatever little knowledge I had. However, when I used the following command:
Code:
git clone git://github.com/AviSynth/AviSynthPlus.git && cd AviSynthPlus
it gave this message:
Quote:
-bash: git: command not found
blaze077 is offline   Reply With Quote
Old 1st November 2016, 01:31   #9  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
With msys2 open:
Code:
pacman -S msys/git
qyot27 is offline   Reply With Quote
Old 1st November 2016, 22:01   #10  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
Thank you. That worked. Now I get the same error with cmake even though I have installed cmake and it has automatically been added to the Windows PATH directory:

Code:
-bash: cmake: command not found
blaze077 is offline   Reply With Quote
Old 2nd November 2016, 01:18   #11  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
I'm pretty sure the CMake installer's 'add to PATH' option puts the parent directory in the PATH, not the one we need. It needs to be C:\Program Files\CMake\bin (or C:\Program Files (x86)\CMake\bin if you're on 64-bit Windows) that's added to the PATH.

To check, run
Code:
echo %PATH%
from the regular Windows Command Prompt, or
Code:
echo $PATH
from inside msys2. Try to find either C:\Program Files\CMake\bin (Command Prompt) or /c/Program Files/CMake/bin (msys2) in the list of directories that show up. If it's *not* in there, then you'll have to either fix or add that directory to the PATH entry manually.
qyot27 is offline   Reply With Quote
Old 2nd November 2016, 22:39   #12  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
The directory "C:\Program Files (x86)\CMake\bin" is there in the Windows PATH. The echo %PATH% command in Windows Command Prompt returns all the directories in PATH whereas the msys echo $PATH gives me this:
Code:
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
blaze077 is offline   Reply With Quote
Old 3rd November 2016, 00:15   #13  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
Okay, I see what happened: https://github.com/msys2/msys2.github.io/issues/20

You need to make sure that msys2_shell.cmd has MSYS_TYPE_PATH set to 'inherit' (open it in Wordpad to check so that the Unix-style line feeds are interpreted correctly). But if I'm reading some of those cases right, when opening msys from the Visual Studio Command Prompt, it should be able to recognize that and inherit the %PATH% without the need to edit things.
qyot27 is offline   Reply With Quote
Old 6th November 2016, 18:54   #14  |  Link
blaze077
Registered User
 
Join Date: Jan 2016
Posts: 79
Sorry for the late reply. The MSYS_TYPE_PATH was set to 'inherit' already so in the end, I just added the cmake directory manually through the export PATH command. Now I'm stuck on the last part:

Code:
cp Output/AviSynth.dll Output/system/DevIL.dll Output/plugins/DirectShowSource.dll \
Output/plugins/ImageSeq.dll Output/plugins/Shibatch.dll Output/plugins/TimeStretch.dll \
Output/plugins/VDubFilter.dll ../$AVSDIRNAME/64bit
This gives me the error:
Code:
cp: target '..//64bit/dev' is not a directory
blaze077 is offline   Reply With Quote
Old 6th November 2016, 19:15   #15  |  Link
qyot27
...?
 
qyot27's Avatar
 
Join Date: Nov 2005
Location: Florida
Posts: 981
You didn't set the AVSDIRNAME variable, or closed/reopened the terminal after you'd set it, or tried setting it when you were in the wrong directory. After cloning the git repo, cd into AviSynthPlus, set the AVSDIRNAME variable, back out of the AviSynthPlus directory, create the build and packaging directories, cd into the build directory, and then run the cmake configure and build commands. And after all that's finished, without closing the terminal at any point, then run the cp instructions to copy the .dlls into the packaging directory.

If the stuff actually built, you can find them in the Output/ directory and manually copy them around as you see fit.

Last edited by qyot27; 6th November 2016 at 19:19.
qyot27 is offline   Reply With Quote
Old 6th November 2016, 19:54   #16  |  Link
FranceBB
Broadcast Encoder
 
FranceBB's Avatar
 
Join Date: Nov 2013
Location: Germany
Posts: 456
Slightly off topic but still about "writing an avisynth plugin". I can generally use the avisynth scripting language in an .avs file or use C/C++, link the avisynth header and make a .dll. My question is: is there a way to handle certain tasks in C++, link the avisynth header AND use the avisynth scripting language for some other task INSIDE a C++ project?
FranceBB is offline   Reply With Quote
Old 6th November 2016, 20:04   #17  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 6,184
Francebb, no chance.

Edit: you can use invoke() to call built in filters though, with args that would be familiar.
You can also call external plugs but have to handle errors if not installed.

Mobile

http://avisynth.nl/index.php/Filter_SDK/Env_Invoke


EDIT: Now seeing comments below, changing my reply from "No chance" to "Yes, Every Chance".
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th November 2016 at 15:51.
StainlessS is offline   Reply With Quote
Old 6th November 2016, 21:32   #18  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,056
I'm pretty sure it's possible. You'll have to generate a script and write it to disk since you can't interact with the script interpreter directly, but once you've done that you can be your own host application and feed input/read output as you wish.

The question is why you want to do this, though. Any logic done in Avisynth script is usually easier done in almost any other language, and if you just want to build filter chains all you need to do is interact with the script environment directly by calling env->invoke() as StainlessS points out. The Avisynth video provider in Aegisub is one example of how to create a "script" (read: filter chain) from a C++ application and use it to read video frames.

Last edited by TheFluff; 6th November 2016 at 21:34.
TheFluff is offline   Reply With Quote
Old 6th November 2016, 23:50   #19  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,377
Quote:
Originally Posted by TheFluff View Post
You'll have to generate a script and write it to disk since you can't interact with the script interpreter directly
Yes you can, simply by using env->Invoke() to call the Eval() function on some script language text.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 7th November 2016, 00:42   #20  |  Link
TheFluff
Excessively jovial fellow
 
Join Date: Jun 2004
Location: rude
Posts: 1,056
Oh right, well there you go then.
TheFluff is offline   Reply With Quote
Reply

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


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