View Full Version : What do you want in your AviSynth Engine?

18th November 2002, 18:48
As an excuse to motivate myself to learn a little more about .NET programming, I've decided to try whipping up an application that writes AviSynth scripts. I really like AviSynther and I use it regularly, but I hate having to go in and tweak the output AVS files whenever I switch between anime/video/film/interlaced/Convolution3D/Lanczos3Resize - you get the idea. So I thought I'd make up a tool that contains all the native AviSynth filters plus can write up a description of imported filters and write routines for them too.

The tentative name for this little tool is the AviSynth Scripting Engine (or ASE for short). I figured if this thing will help people who can't remember every single filter by heart (or would rather use an easy interface rather than typing in scripts by hand) I should probably release it for you guys to play around with. But I'm not sure what all I should put into it. I know AviSynth has a lot of different modes (inline, OOP, functions within functions, etc.) so I'd like to hear some input on how you guys use AviSynth for your scripts and how you'd use a tool like ASE for your encoding jobs. So let's make with the feedback and wishlists! :D

18th November 2002, 23:49
Good going! This looks very promising . . . I'll definitely stay tuned. I can't give any advice for now. But just thought you'd like to know at least one person will be waiting with bated breath for more news. :D

19th November 2002, 02:48
Attached is a sample of what the AviSynth Plugin Definition (APD) file will look like. This file will be a description of an external plugin, all of its filters, parameters, and values. You'll need to write this out yourself (as I can't figure out how to query a DLL for its interface yet) but I'm currently working on a utility that'll make writing the APD fairly easy.


For those of you who don't want to wait for the attachment to be enabled, here's basically what it looks like.




# - comment
$ - AviSynth Scripting Engine directive (UseNamedParameters sets to create script with parameter names)
[] - AviSynth filter
@ - AViSynth filter parameter
% - AviSynth filter parameter value
<> - default value
:xx - number of values
* - all parameters are required

19th November 2002, 07:41
Can you add some kind of crop and resize system to your program? I already have some working .NET code you can work with. All code is written in C#.


PM me if you'd like to see the source.

19th November 2002, 09:43
not quite sure if i got the full gist of what the app is meant to do, but here's my list of things - sorry if some are vague

1) "loadplugin" and "avisource" that work like the "open file" dialogue in ms word, or maybe even like a winamp playlist, i.e. that allows you to graphically navigate through directories looking for the target file, e.g. just like hitting the "browse" /attach file button when posting on the doom9 forum

2) how about like a quicksave "restore point" - quickly save the current script content to memory, then you mess up the script and you want to revert, you hit restore and bosh, script reverts to last restore point (i guess it may not necessarily be the one last saved to disk)

3) edit undo/redo like in ms word

4) display avisynth dll version number in the menu bar or somesuch

5) some kind of incorporation of / integration with the vdub_import_filter

6) open current script in virtualdub, save and refresh from current script like virtualdubmod

7) incorporate tr barry's checkparity function against a given clip

8) filter toolbar - group filters together by description and have them select-able from dropdown (e.g. like pastefunction button/dialogue screens in ms excel, e.g. "resize": pointresize,bilinearresize...validation of parameters) ...or maybe like a font dialogue box in ms word

9) commercials trim helper-tool or mini-wizard - make it easy (somehow) for the user to provide clip frame ranges as (e.g.) tv show segments, which can then be alignedspliced back together into one big e.g. clip3=clip1+clip2... (i.e. have the range that excludes commercials)

19th November 2002, 10:02
Might be OT but just thought I'd ask...

Is there anyway to query the DLL about the version number of the AviSynth build. So an App that interfaced with Avisynth could do a...
hDLL = LoadLibrary("AviSynth.dll")
MajorfuncPtr = GetProcAddress("GetVersionMajor");
MinorfuncPtr = GetProcAddress("GetVersionMinor");
if ( MajorfuncPtr == NULL || MinorfuncPtr == NULL )
printf("Version is below 2.5 (or something ;) )");
printf("AviSynth Version %d.%02d", MajorfuncPtr(), MinorfuncPtr());

...or similar?

If not if someone could put something that could do that (or similar) in the CVS, i'd appreciate it... :)


19th November 2002, 22:35
First, I found a little bug in my ADP syntax - no indication of the value type needed (ex. boolean, string, int, float, etc.) so I'll be adding that to the official ADP definition somewhere. Don't take what I posted before as gospel; life is subject to change without notice. :D

replies to:

Emperor - All this will do is write out your scripts for you; you'll still need WMP or something to view the output. I may Shell out to WMP or mplayer2 (WMP6) to preview scripts, but I've not decided yet. The basic version will just write out standard AviSynth filters and query the user for what values they want to use with each filter and write that into the script automatically. Thanks for the offer, though; once I finish all the basics I'll see about adding extra stuff like what you've got there. :)

wotef - 1. Load plugin (all three types) will have a dialog box that find the path of the plugin dll and write out the appropriate LoadPlugin(xx) statement in the AVS. However, since I can't figure out how to access the interface from a C++ dll (writing this in VB.NET), you'll need to write up the interface yourself in a special format called an APD file. (I'm also working on a utility to help you do that too.) So ASE will ask you to locate the plugin file, then it will ask you for the APD file so it can load the plugin filter information for you to use.

2. Not a bad idea, maybe a quicksave every few commands... I'll look into that. .NET textboxes are supposed to have a ClearUndo method that brings back all the text if you accidentally delete it but I can't seem to get it to work right all the time...

3. I'll look into it.

4. ASE doesn't actually interface with AviSynth, I'm just writing filter definitions from the manual included with the 2.0.5/2.0.6 release. So everything should work with AVS 2.0.6 and up. I can put something to that effect in the documentation, though...

5. So long as you write up the definitions first, you'll be able to import external plugins, VDub plugins, and VFAPI plugins, using normal AviSynth "LoadPlugin" statements.

6. Not sure what this means... You'll be able to save the script you write, then open that normally in anything else... Clarification please?

7. I don't know that trbarry's checkparity function does.

8. This is actually exactly the way I was going to write out the interface... Great minds think alike! :)

9. The first release of ASE will be just linear editing, but you can manually import clips (a group of AVISource filters) and splice them together. After I get the basics finished, I'll look into OOP notation and helper functions for variable assignments.

Nic - not quite OT, but as I've said earlier, ASE won't actually interface to AviSynth in any way.

Just so everyone knows, I'm not writing this as a VirtualDub that writes AVS scripts for you - that's already been done (see VDubMod/VDubOGM). I'm just writing up a little helper that'll allow you to pick a filter, query you for the values to enter in each field, and write out the correct syntax in a script. You'll still need to know how to use AviSynth correctly, ASE will just help you write your scripts easier and faster. I'll see if I can put up a small demo version in the next few days so you can all get an idea of what to expect.

PS to any mods: is this okay on the AviSynth forum or should this thread be moved to the Programming forum?

To everyone: thanks for the info, and I hope you all enjoy ASE when I get it finished! :D

19th November 2002, 23:14
right, discard (6) then

have a read of this thread (http://forum.doom9.org/showthread.php?s=&threadid=34511) to check out tom's useful function

High Speed Dubb
19th November 2002, 23:21
Would it be useful to include optional brief explanations of each filter and each parameter in the filter description? That could allow some decent script editing without digging through lots of help files.

20th November 2002, 00:54
@wotef: consider 6) nixed. :D As for trbarry's function, it looks like maybe I should consider adding a separate module for storing functions as well as filters. I'll see about that after the basics are done. Thanks for the link, btw.

@Dubb: I was thinking about that very same idea, and with some of the stuff I've been seeing in .NET it's fairly easy to do, but I wanna check with the folks working on AviSynth before I borrow from their docs. If they give the go-ahead, I'll include the info.

Hopefully by tonight, I'll have most of the coding for the AviSynth Plugin Description Writer (or APDW) finished - that's the utility that actually allows you to write up a script representing the interface of an AviSynth plugin DLL. It writes scripts in the funky markup that I posted earlier, so you won't be able to do much with it, but if you want to play around a bit and write up APDs for your favorite plugins just to see what they look like, feel free.

22nd November 2002, 00:18
Okay, I think I tracked down nearly all the bugs in the APDW utility and it will be posted to my website tonight (http://www.randrproductions.com/RAGE/) if anybody wants to take a look at it. The APD format is now fixed, so the output of this utility will be exactly what is read into ASE. The output is fairly unintelligible, but I will be working on docs for APDW later today and will post them on the website too. So what are you waiting for? Time to get cracking on making up APDs for all your favorite AviSynth plugins! :D

PS ASE will probably have quick help or tool tips for each of the filters so you don't have to go digging through the docs for info on everything. I talked to Richard Berg, project manager for AviSynth, and he said that it's okay to use the text from AviSynth's docs, so you're getting documentation from the best source on earth: AviSynth's creators!

High Speed Dubb
22nd November 2002, 02:41
Do you have some documentation for it? On running it, I get an error dialog &mdash;
APDW.EXE - Application Error
This application failed to initialize properly (0xc0000135). Click on OK to terminate the application.

Do I need some .net stuff to run this?

22nd November 2002, 05:00
Yeah, this runs on .NET, so make sure you get the latest patches and upgrades from Windows Update. I'll put up an special installer on the website that includes the .NET redistributable. It'll probably be about 20MB or so (I think that's what the .NET documentation said) so there'll be a special binary-only download too.


I ran across a few bugs I missed earlier dealing with default values and browsing for files in the Plugin Definition screen. They're now fixed, so everything should work.

So far the only major issue is that if you add two parameters with the same name to one filter, then try to delete one of the parameters or one of the values attached to the parameters, the indexes will get screwed up and crash the program. The way the value search function works makes this very hard to work around. This fact will be included in the documentation, and as plugins don't generally have filters with a bunch of parameters with the same name, it shouldn't be a big problem.

22nd November 2002, 05:17
Forgot to post the updated binary.

22nd November 2002, 09:34
I'm glad there is another .NET application, because more applications means more people will install the framework and less people will bother :D

23rd November 2002, 21:08
I hunted down a few bugs this morning and fixed them. Here's a new update. I'm currently working on documentation for APDW and will try to have it done and posted to the site by tomorrow at the latest. Included with this copy of APDW is an APD I wrote up for Vlad59's Convolution3D filter. As you can see, each line in the APD corresponds to one of the parameters or values for C3D, and ASE will be able to read this file and write out Avisynth statements with correct syntax and values.