Plugins
Raffriff42 (Talk | contribs) m (tweak appearance) |
(→LoadVirtualDubPlugin: Add avs+ rangehint parameter) |
||
Line 35: | Line 35: | ||
|LoadVirtualDubPlugin (string ''filename'', string ''filtername'' [, int ''preroll'']) | |LoadVirtualDubPlugin (string ''filename'', string ''filtername'' [, int ''preroll'']) | ||
}} | }} | ||
+ | <br>{{AvsPluscon}}{{FuncDef | ||
+ | |LoadVirtualDubPlugin (string ''filename'', string ''filtername'' [, int ''preroll''][, string ''rangehint'']) | ||
+ | }} | ||
+ | |||
:{{Par2|filename|string|}} | :{{Par2|filename|string|}} | ||
::The path of the '''.VDF''' file. | ::The path of the '''.VDF''' file. | ||
Line 41: | Line 45: | ||
:{{Par2|preroll|int|0}} | :{{Par2|preroll|int|0}} | ||
::Some filters' output depends on previous frames; for these, {{FuncArg|preroll}} should be set to a suitable number. | ::Some filters' output depends on previous frames; for these, {{FuncArg|preroll}} should be set to a suitable number. | ||
+ | |||
+ | :{{AvsPluscon}}{{Par2|rangehint|string|""}} | ||
+ | :There can be an extra filter parameter added at the end of filter's (unnamed) parameter list:<code>string ''rangehint''</code>. See "[[LoadVirtualDubPlugin]]" documentation | ||
+ | :The imported Virtualdub filters (of course which are supporting the extra features) are getting and extra named parameter to the end. | ||
+ | :This parameter can tell the filter about a YUV-type clip colorspace info | ||
+ | :Allowed values: | ||
+ | ::* "rec601": limited range + 601 | ||
+ | ::* "rec709": limited range + 709 | ||
+ | ::* "PC.601": full range + 601 | ||
+ | ::* "PC.709": full range + 709 | ||
+ | ::* "" : not defined (same as not given) | ||
+ | :Parameter will be ignored when clip is non-YUV | ||
+ | :How it works: the hint will _not_ change the internal VirtualDub colorspace constant (e.g. kPixFormat_YUV420_Planar -> kPixFormat_YUV420_Planar_709 will not happen). | ||
+ | :Instead the base color space is kept and colorSpaceMode and colorRangeMode will set in PixmapLayout.formatEx. | ||
+ | :Filter can either use this information or not, depending on supported API version and its implementation. | ||
+ | :E.g. <code>Crossfade(20,30) -> Crossfade(20,30,"rec601")</code> though this specific filter won't use it. | ||
+ | |||
*VirtualDub filters support only [[RGB32]]. | *VirtualDub filters support only [[RGB32]]. | ||
*Usage example ([http://trevlac.us/colorCorrection/ ColorTools]) – see [http://forum.doom9.org/showthread.php?t=72634 '''here'''] (doom9). | *Usage example ([http://trevlac.us/colorCorrection/ ColorTools]) – see [http://forum.doom9.org/showthread.php?t=72634 '''here'''] (doom9). | ||
*See [[FAQ_using_virtualdub_plugins|FAQ using Virtualdub plugins]] for more information. | *See [[FAQ_using_virtualdub_plugins|FAQ using Virtualdub plugins]] for more information. | ||
− | |||
====LoadVFAPIPlugin==== | ====LoadVFAPIPlugin==== |
Revision as of 11:54, 2 July 2018
With these functions you can add external filters (DLLs) to the AviSynth script environment.
Contents |
LoadPlugin
Loads one or more standard (C++) AviSynth plugins.
LoadPlugin(string filename [, string filename...])
- string filename =
- The path of the .DLL file(s).
LoadCPlugin
Loads so-called AviSynth C-plugins. C-plugins are created in pure C (unlike most Avisynth plugins, which are created with MS C++), use a special C API, and must be loaded with LoadCPlugin.
LoadCPlugin(string filename)
LoadCPlugin(string filename [, string filename...]) AVS+
Load_Stdcall_Plugin(string filename)
Load_Stdcall_Plugin(string filename [, string filename...]) AVS+
- string filename =
- The path of the .DLL file(s).
- The plugin's documentation should advise you if LoadCPlugin is needed.
- Load_Stdcall_Plugin is merely an alias or alternate name.
- Advice: keep these plugins outside your autoload directory to prevent crashes.
LoadVirtualDubPlugin
Loads a plugin written for VirtualDub. These are distributed as special DLLs with the file extension .VDF.
LoadVirtualDubPlugin (string filename, string filtername [, int preroll])
AVS+LoadVirtualDubPlugin (string filename, string filtername [, int preroll][, string rangehint])
- string filename =
- The path of the .VDF file.
- string filtername =
- The name to be given to the plugin function after loading in AviSynth.
- int preroll = 0
- Some filters' output depends on previous frames; for these, preroll should be set to a suitable number.
- AVS+string rangehint = ""
- There can be an extra filter parameter added at the end of filter's (unnamed) parameter list:
string rangehint
. See "LoadVirtualDubPlugin" documentation - The imported Virtualdub filters (of course which are supporting the extra features) are getting and extra named parameter to the end.
- This parameter can tell the filter about a YUV-type clip colorspace info
- Allowed values:
- "rec601": limited range + 601
- "rec709": limited range + 709
- "PC.601": full range + 601
- "PC.709": full range + 709
- "" : not defined (same as not given)
- Parameter will be ignored when clip is non-YUV
- How it works: the hint will _not_ change the internal VirtualDub colorspace constant (e.g. kPixFormat_YUV420_Planar -> kPixFormat_YUV420_Planar_709 will not happen).
- Instead the base color space is kept and colorSpaceMode and colorRangeMode will set in PixmapLayout.formatEx.
- Filter can either use this information or not, depending on supported API version and its implementation.
- E.g.
Crossfade(20,30) -> Crossfade(20,30,"rec601")
though this specific filter won't use it.
- VirtualDub filters support only RGB32.
- Usage example (ColorTools) – see here (doom9).
- See FAQ using Virtualdub plugins for more information.
LoadVFAPIPlugin
Loads VFAPI plugins (eg, QTReader, TMPGEnc). These are distributed as special DLLs with the file extension .VFP.
LoadVFAPIPlugin (string filename, string filtername)
- string filename =
- The path of the .VFP file.
- string filtername =
- The name to be given to the plugin function after loading in AviSynth.
Plugin Autoload and Name Precedence
It is possible to put all plugins and script files with user-defined functions or (global) variables in an autoload directory, from which all files with the extension .AVSI and .DLL are loaded at startup, then unloaded and reloaded dynamically as the script needs them.
.AVSI scripts in this directory should only contain function definitions and global variables; they should not have a main processing section (else strange errors may occur). It also is not recommended to put other files in that directory.
The directory is stored in the registry. You can use double-clicking a .REG-file with the following lines to set the path (of course inserting your actual path):
REGEDIT4 [HKEY_LOCAL_MACHINE\SOFTWARE\Avisynth] "plugindir2_5"="c:\\program files\\avisynth 2.5\\plugins"
The order in which function names take precedence is as follows:
- User-defined function (always have the highest priority)
- Plugin (external) function (higher priority than built-in)
- Built-in (internal) function
Inside those groups the function loaded last takes precedence; there is no error in a namespace conflict.
It follows that there is no harm in loading the same plugin more than once.[dubious – discuss]
Plugin Autoload and Conflicting Function Names
A problem that may arise when multiple plugins have functions with the same name. You won't know which function will be called in your script, as this will depend on loading order. To call a particular function in this situation, AviSynth's DLLName_function() feature automatically creates prefix aliases; so for example, foo.dll's bar() function may be called as foo_bar(). This works both for auto-loaded plugins and for plugins loaded with LoadPlugin.
Suppose you have the plugins mpeg2dec.dll and mpeg2dec3.dll in your autoload directory; if you call
mpeg2source("F:\From_hell\from_hell.d2v")
you won't know which plugin will be used in your script, as both have an mpeg2source function.
To load the file with mpeg2dec.dll (which outputs YUY2), call
mpeg2dec_mpeg2source("F:\From_hell\from_hell.d2v")
or to load the file with mpeg2dec3.dll (which outputs YV12), call
mpeg2dec3_mpeg2source("F:\From_hell\from_hell.d2v")
Back to AviSynth Syntax.