Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.


Go Back   Doom9's Forum > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Thread Tools Search this Thread Display Modes
Old 23rd November 2018, 16:04   #1  |  Link
Registered User
Join Date: Dec 2008
Location: Germany
Posts: 157
Using avisynth-script like a filter (feed filename into it)

Is there a way to use a avisynth-script in vdub with different inputfiles?

In a normal way the filename is hardcoded in the avisynth-script, but this makes it impossible to reuse the script without editing the filename each time. Would be very cool to put avisynth-scripts into vdub-plugin-folder (as a template) and reuse them like normal filters. Of course vdub must change some placeholder for the inputfilename-variable inside avisynth-script. (for parallel-use the script should be temporary copies / duplicated)

Isre-using a script already possible, some way ?
mbcd is offline   Reply With Quote
Old 23rd November 2018, 16:25   #2  |  Link
Registered User
Join Date: Dec 2005
Location: Germany
Posts: 1,199
I used import("episodenumber.avs") for my encodes via a bat file. You can just set a variable name or use a source filter.
Never used vdub templates so can't comment on what.
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database || https://github.com/avisynth-repository
ChaosKing is offline   Reply With Quote
Old 23rd November 2018, 16:37   #3  |  Link
HeartlessS Usurer
StainlessS's Avatar
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,065
Not exactly what you want but maybe of use,


Suggest Batch Mode, ie create your avs template and then group select input files, "Send To" Avisynthersizer and it will create one avs script for each input file.

EDIT: I have used VirtualDub templates, and they worked well, but cannot for the life of me
remember anything about how they worked.
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 23rd November 2018 at 16:45.
StainlessS is online now   Reply With Quote
Old 23rd November 2018, 18:36   #4  |  Link
Registered User
Join Date: Mar 2015
Posts: 744
These are only hints because I didn't use:

method1: VirtualDubMod avs templates, afaik after opening with a template you get a synthesized script into editor, which you must save before using.
method2: ffdshow source/filter. It adds special function to avs environment to access currently opened video.
shekh is offline   Reply With Quote
Old 23rd November 2018, 18:53   #5  |  Link
Registered User
jmartinr's Avatar
Join Date: Dec 2007
Location: Enschede, NL
Posts: 296
You can use Stickboy's GetSystemEnv plugin to read environment variables and use that as a solution.

For example:
file = GetSystemEnv("filename")

audio = FFAudioSource(file)
video = FFVideoSource(file)
AudioDub(video, audio)
Roelofs Coaching
jmartinr is offline   Reply With Quote
Old 24th April 2020, 19:25   #6  |  Link
Registered User
mattsmith321's Avatar
Join Date: Mar 2008
Location: Austin, TX
Posts: 14
I know this is an old thread but I ran across it while trying to do the same thing. I ended up putting something together and wanted to share in case it helps someone down the road. In my case I had 1800+ videos that I needed to process to deal with interlacing issues (from https://youtu.be/d4rLvpkBlnQ):

My approach was that instead of trying to make AviSynth process a different file name each time, I would instead bring my source file to my processing location, rename it to the name in my AviSynth file, then output it to my target name.

My AviSynth file is called MiniDV.avs and contained the following lines. As you can see, I am always processing "Input.avi":
SetFilterMTMode("QTGMC", 2)
FFmpegSource2("Input.avi", atrack=1)
QTGMC(Preset="Slower", Edithreads=1, Sharpness=3.0, EZDenoise=3.0, NoisePreset="Fast")
I then have a wrapper MiniDV.bat batch file to trigger my ffmpeg script and do the file movements that I needed. You can see where I xcopy the file from my source location and rename it to Input.avi in my processing location (where ffmpeg is running). Then for the ffpmpeg output parameter I tell it to save it to my target location with the original name but with a new prefix.
for %%f in (\\server\archive\MiniDV\2020\*.avi) do (
  set /p val=<%%f
  echo "Starting copy of: %%f"
  xcopy /y %%f Input.avi*
  echo "Finished copy"

  echo "Starting conversion..."
  ffmpeg -i "MiniDV.avs" -c:v libx264 -preset medium -tune film -c:a aac \\server\video\2020\%%~nf.mp4
  echo "Finished conversion"
  echo "Deleting input file..."
  del Input.avi
  echo "Finished deleting"
My 1800 files were in 10 different year directories. I'm sure I could have modified the script to process all of them in one go, but I did it year by year and updated the MiniDV.bat script to change the year in two locations. The only issue that needs to be tweaked is that the script needs the output directory to exist.

Those 1800 files were about 350GB and 30 hours of video. The script took about 70-75 hours to process all of the files. The final output is about 25GB of MP4 content that is so much better than any other attempts I have had in 15 years of having that particular camera and messing with the video.

Hope it helps someone. Looks like I registered here in 2008, didn't do much, disappeared for 12 years, and now leaving again. Take care!
Matt Smith
mattsmith321 is offline   Reply With Quote
Old 24th April 2020, 23:53   #7  |  Link
HeartlessS Usurer
StainlessS's Avatar
Join Date: Dec 2009
Location: Over the rainbow
Posts: 8,065
This is a script I used to use as VirtualDubMod Template,
presumably for conversion of only short files, eg music tracks.

audio=SSRC(audio,44100)                 # audio=ResampleAudio(audio,44100) # Alternative if SSRC throws error for certain conversion factors
Audio_Samples =AudioLength()
Audio_Length_In_Seconds=Audio_Samples / 44100.0
Video_Frames=ceil(Audio_length_In_Seconds * 100.0)
#messageclip("length is " + string(AudioLength()))
return last
I think I used to generate the files with embedded filenames at '%f', then maybe saved result WAV.
Think I also did something to batch add loads of them to VDMod joblist to save WAV files.
Long time ago, dont remember exactly. [EDIT: File last modified 2006]

Another template from 2006 for DGIndex's DGDecode.dll

last=Video	# Just so last gets a value if omitting Audio
#Audio = WavSource("D:\D2V\*.WAV")
#LoadVirtualdubPlugin("c:\delogo.vdf", "delogo", 0) 
#SeparateFields()			# Use to check field order
# 2nd last  arg is interlaced
#delogo(1,"","D:/T/deblend.bmp","D:/T/alpha.bmp","D:/T/color.bmp","D:/T/repair.bmp",15, 40, 1, 0)
#				Telecide
# Guide(0=Blind,1=30->24fps,2=PAL LOCK,3=30->25fps)
# Post(0=Disable,2=Deinterlace)
#----------------- FieldDeint YUY2/YV12 ----------------
# full=true to consider ALL frames combed.
# blend=true to use blend rather than interpolate.
#----------------- KernelDeint YUY2/YV12/RGB -----------
# order=0 is bottom field first, MUST be set
# ---------------- Levels ------------------------------
# ------ Levels(ip_low,gamma,ip_high,op_low,op_high) ----
return last
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 25th April 2020 at 00:21.
StainlessS is online now   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT +1. The time now is 15:00.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.