for AviSynth 2.5x
Write (clip, string "filename", string "expression1",
... , string "expression10", bool "linecheck", bool "flush",
bool "append", bool "nofail")
Write evaluates "expressionN", converts it to a string and puts
the result into a file.
The "run-time" variable "current_frame" is set so that
you can use it in an "expression"
(this works similar as with ScriptClip, look there in the docu for more infos).
LoadPlugin("c:\myprojects\dvinfo\release\CHR.dll") |
At the time the script is loaded, the expressions are evaluated, too with current_frame
= -1.
This can be used for writing a header, as we will see later.
With "flush=true" (default) the file will be closed after each frame (you can open the file and see the results), with "flush=false" it will be closed only when the script is closed (which may be a little faster).
With "append=false" (default) each time you start the script the file will be deleted first.
"nofail=true" (default) will print the expression itself, if it can't be evaluated, "nofail=false" will print the error message.
Write(filename, "this is nonsense") with nofail=true will result in: this is nonsense and with nofail=false in: I don't know what "this" means |
...with this example you can see how to use the "runtime functions" together with FrameEvaluate:
Version.FadeIn(50).ConvertToYV12 # create a test video to get different frames |
Or maybe you want the actual time printed, too:
Version.FadeIn(50).ConvertToYV12 # create a test video to get different frames # this will print the frame number, the current time and the average luma for that frame # the chr(34) is necessary as there is no way to put quotes inside a string Write(last, filename, "current_frame", "time(" + chr(34) + " %H:%M:%S " + chr(34) + ")", "AverageLuma") |
The clip that is used by AverageLuma must be the end of the filter chain for
that clip.
Use a intermediate variable if you process the clip farther:
This will crash: |
If you set linecheck=true the FIRST expression is expected to be boolean (true
or false).
Only if it is TRUE the other expressions are evaluated and the line is printed.
(Remember: && is AND, || is OR, == is EQUAL, != is NOT EQUAL)
That way you can ommit lines completely from your file.
Version.FadeIn(50).ConvertToYV12 # create a test video to get different frames |
for AviSynth 2.5x
String (variable, format_string)
Does the same as the standard String, but if the variable is float or integer, it converts it to a float and uses the format_string to convert it to a string.
The syntax of the format_string is as follows:
%[flags][width][.precision]f
width: the minimum width (the string is never truncated)
precision: the number of digits printed
flags:
- left align (instead right align)
+ always print the +/- sign
0 padding with leading zeros
' ' print a blank instead of a "+"
# always print the decimal point
String(1.23, "%f") '1.23' String(1.23, "%5.1f") ' 1.2' |