Creating multiple videos with Avisynth

I've never found a way to pass a command line parameter directly to a AVS script. Generating scripts on the fly is the only way I was able to get it working.

I know this is not the answer you're looking for - nevertheless two approaches for generating scripts:

Template script

I use this when I have a AVS script where the only parameter which changes is the source input file.

I have a script template.avs which expects a variable (v) containing the full path of the source video. A batch script then simply prepends the line with the variable for each video file, similar to this:

@echo off
if "%1" == "" (
    echo No input video found
    pause
    GOTO :EOF
)
set pth=%~dp0

:loop
IF "%1"=="" GOTO :EOF

echo v="%1">"%pth%_tmp.avs"
type "%pth%template.avs">>"%pth%_tmp.avs"

:: Do whatever you want with the script
:: I use virtualdub...
"%vdub%" /i "%pth%Template.vdscript" "%pth%_tmp.avs"

del "%pth%_tmp"

SHIFT
GOTO loop

This allows me to simply drag-and-drop several source videos onto the batch.

Import

Using the Import instruction, it is possible to externalize all the variable declarations into its own script.

Import("variables.avs")

This is useful when the template AVS script expects multiple variables.