Log in

View Full Version : Setting variables for AviSynth in batch file


Peter1234
9th October 2005, 21:10
I have been trying to find out how to modify variables in an AviSynth script from a batch file for some time with no luck. But I have finally learned how and I thought I would make a post that others could find (my searches yielded no results). Thanks to Pookie for referring me to a reference that helped me learn how to do this. It is really quite simple (if you know how). Adding the following lines to the batch file will generate three AVS files.

@echo off
echo h=480 > h.avs
echo w=640 > w.avs
echo source="divx.avi" > source.avs

Then using Import in the AviSynth script will set these variables in the script as follows.

Import ("source.avs")
Import ("h.avs")
Import ("w.avs")
AVISource(source)
BilinearResize(w,h)

That’s it. Very simple if you know how. There is probably a way to make one AVS file that has three lines, but I haven’t learned how to get echo to put multiple lines in the AVS file yet.

gzarkadas
9th October 2005, 22:00
To append lines to a file with echo, simply use >> to all subsequent lines after the first one instead of > (> overwrites contents of target file, while >> appends to it).

An example:

echo w = 640 > input.avs
echo h = 480 >> input.avs
echo source = "divx.avi" >> input.avs

After that, you only have to import one file, "input.avs"

Peter1234
9th October 2005, 22:15
@gzarkadas :
Thanks.