The runtime environment is an extension to the normal AviSynth script execution environment that is available to scripts executed by runtime filters. Its basic characteristic is that the runtime filters' scripts are evaluated (compiled) at every frame. This allows for complex video processing that it would be difficult or impossible to perform in a normal AviSynth script.
Let's now look at the above definition in more detail. The runtime environment is:
The last is the biggest difference. Normal script code is parsed and evaluated (compiled) at the start of the script's execution (the parsing phase) in a linear fashion, from top to bottom; the result is the creation of a filter graph that is used by AviSynth to serve frames to the host video application. Runtime script code is executed after the parsing phase, when frames are served. Moreover it is compiled on every frame requested and only for that specific frame, in an event-driven fashion.
Note: Audio is not handled by the runtime environment; it is passed through untouched. This also means that you cannot modify clip audio with runtime filters.
The following filters are the basic set of the so-called "runtime filters":
In addition, the WriteFile filter can also be considered a runtime filter, because it sets the special variables set by all runtime filters before evaluating the expressions passed to it, which can use the special runtime functions.
All runtime filters set and make available to runtime scripts the following special variables.
All the above variables are defined at the top-level script local scope. That is you read and write to them in a runtime script as if they where variables that you declare at the script level.
Runtime scripts can also call a rich set of special functions that provide various pieces of information for the current frame of their input clip.
Using the runtime environment is simple: you use one of the runtime filters and supply it with the needed arguments. Among them, two are the most important:
The latter is supplied as a string argument which contains the AviSynth script commands. Scripts can contain many statements (you can use a multiline string), local and global variables and function calls, as well as special runtime functions and variables. In general all statements of the AviSynth syntax are permitted, but attention must be paid to avoid overly complex scripts because this has a penalty on speed that is paid at every frame. See the runtime section of scripting reference's performance considerations for details.
Let's see a few examples:
TODO...EXAMPLES
Back to AviSynth Syntax.
$Date: 2008/12/07 15:46:17 $