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. |
30th October 2016, 03:29 | #1 | Link | |
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:
I am using Avisynth+ r2173. |
|
30th October 2016, 04:24 | #2 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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). |
30th October 2016, 05:19 | #3 | Link |
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. |
30th October 2016, 06:14 | #4 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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 |
30th October 2016, 10:42 | #6 | Link | |
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
|
Quote:
Edit: The "official" 2.6 Avisynth installer does offer the option to install the C-header and avisynth.lib.
__________________
Groucho's Avisynth Stuff Last edited by Groucho2004; 30th October 2016 at 11:26. |
|
30th October 2016, 17:24 | #7 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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). |
31st October 2016, 22:58 | #8 | Link | |
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 Quote:
|
|
2nd November 2016, 01:18 | #11 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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% Code:
echo $PATH |
2nd November 2016, 22:39 | #12 | Link |
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 |
3rd November 2016, 00:15 | #13 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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. |
6th November 2016, 18:54 | #14 | Link |
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 Code:
cp: target '..//64bit/dev' is not a directory |
6th November 2016, 19:15 | #15 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,420
|
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. |
6th November 2016, 19:54 | #16 | Link |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
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?
|
6th November 2016, 20:04 | #17 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
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. |
6th November 2016, 21:32 | #18 | Link |
Excessively jovial fellow
Join Date: Jun 2004
Location: rude
Posts: 1,100
|
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. |
|
|