View Full Version : generate avs-script for similar sourcefiles in directory
DaisyF
6th July 2004, 17:55
Hi,
I backup old tv-episodes (from .rm) and use an avs-script to feed each file to the encoder.
Thing is : I have a directory with 356 episodes, they all need the same kind of script.
This is an example for 16 may 2003 :
--begin----------
filename is 20030516.avs
DirectShowSource("c:\RealMedia\20030516.rm",25)
BilinearResize(352,288)
--end------------
For each realmediafile I need to change the .rm-filename in the above example and save it under its own .avs-filename
Is there a way to automate this for an entire directory ? I have been searching for a week but no luck.
Anyone ?
Daisy
stickboy
6th July 2004, 18:51
From the command prompt, you can do something like:
for %x in (*.rm) do (
echo.DirectShowSource^("%x",25^)
echo.BilinearResize^(352,288^)
) > "%~nx.avs"If your scripts need to be any more advanced than that, then you should put that stuff into a common .avs file:
function DoIt(string filename)
{
DirectShowSource(filename, 25)
BilinearResize(352, 288)
# ... other AviSynth processing commands...
return last
}and then in the auto-generated .avs files:for %x in (*.rm) do (
echo.Import^("common.avs"^)
echo.DoIt^("%x"^)
) > "%~nx.avs"
DaisyF
6th July 2004, 20:59
I'm trying this out now and hope I can make it work. Then I will look into the syntaxis some more because this is real interesting stuff.
Thanks and I will post feedback
D
DaisyF
6th July 2004, 23:44
When you say :
-----------
From the command prompt, you can do something like:
code:
for %x in (*.rm) do (
echo.DirectShowSource^("%x",25^)
echo.BilinearResize^(352,288^)
) > "%~nx.avs"
---------------
What kind of prompt do you mean ? Since reading your reply I have looked into .vcf, sylia and also java script, since I assume that is the environment where you use that type of code. I nowhere find the syntax for
%x = string being filename; I don't find what % means in this expression
*.rm = whatever.rm
%~nx.avs = building all the filenames
In my day to day life I don't do that much programming (not counting turbo pascal for math).
Could you point me to a faq that could cover this ? Or suggest an environment for the command line. I will try to figure this out for myself but the curve right now is too steep.
Daisy
Originally posted by DaisyF
What kind of prompt do you mean?
The newfangled DOS prompt-replacement that ships with Windows 2000/XP, aka CMD.EXE.
Just select "Run..." in your start menu, enter "cmd" and hit enter. There also should be a "Command Prompt" shortcut somewhere around the "Accessories" folder in your programs folder in the start menu.
np: Wagon Christ - The Funnies (Sorry I Make You Lush)
DaisyF
7th July 2004, 10:23
That prompt, ah, I use it all the time.
Really I do... I feel manure-like for not having tried that.
OK, so I just did it.
F*********k, (pardon my french) that is some powerfull instruction. It's making my day as we speak. I'm looking at a whole directory full of .avs :) :) :)
Thanks,
D
sh0dan
8th July 2004, 11:02
Just beeeped out a little. No profanities here! :rolleyes:
Anyway - I have made a webpage that allows you to generate a zip-file containing all the scripts you need. I wrote a bit about it here (http://www.avisynth.org/IntermediateTips) [avisynth.org].
It's quite simple - you insert the script in one box, and the filenames in the second, press "Generate" and download the Zip-file containing your avs files.
Mug Funky
8th July 2004, 12:51
that's very cool sh0dan...
niamh
8th July 2004, 16:23
What about avisynthesizer?
Basically you create one template, and then all you have to do is right click the file and send to asynther, and the script is created :)
first link I found on google :) (http://tangentsoft.net/video/asynther/)
DaisyF
8th July 2004, 17:44
Thanks for the help. I haven't tried avisynth yet but I will...
At the moment I wrote two template avs-scripts which I then apply on a directory with doIt.
In the time of Dos (386-486) I was into Amiga so I lost out on that. I need to catch up :)
D
Eric B
28th May 2006, 18:04
I ve first tried the script described above (for %x in (*.rm ...) in a batch file, but my cmd does not like it.
So I went to http://www.avisynth.org/BatchScripting
And then, it works.
Thanks sh0dan.
stickboy
28th May 2006, 20:44
I ve first tried the script described above (for %x in (*.rm ...) in a batch file, but my cmd does not like it.And exactly what happened? What OS are you using? Simply saying that it doesn't work is not helpful.
If you tried it in a .bat/.cmd file, you need to replace %x with %%x .
Eric B
1st June 2006, 19:55
Oh, you answered. Great!
As I find the batch solution even easier, I ve tried again. First, with %%, it is already much better. But what I ve done is still not correct:
my makeAvs.bat (WinXP) is
for %%x in (*.mov) do (
echo.Import^("makeAvs_template.avs"^)
echo.DoIt^("%%x"^)
) > "%%~nx.avs"
and may makeAvs_template.avs:
function DoIt(string filename)
{
LoadPlugin("UnDot.dll")
LoadPlugin("FluxSmooth.dll")
DirectShowSource(filename , fps=30)
ConvertToYV12()
Undot()
FluxSmoothST(7,7)
return last
}
The avs file are generated, but they contains for example:
Import("makeAvs_template.avs")
DoIt("P1030015.MOV"), which I find logical regarding the echo cmd. I probably did not correctly understood. Can the cmd shell really work with function ?
stickboy
2nd June 2006, 08:34
The avs file are generated, but they contains for example:
Import("makeAvs_template.avs")
DoIt("P1030015.MOV"), which I find logical regarding the echo cmd. I probably did not correctly understood.I'm not following what you mean; the generated .avs file looks correct to me. What's wrong with it?
Can the cmd shell really work with function ?The cmd shell is perfectly capable of generating all those .avs files, but you'll need to open them and process them with something else (like using VirtualDub's batch mode).
diffid
19th July 2010, 22:35
Does anyone know how to create .avs files from a directory listing using a template on Linux with or without wine. I've tried wine's cmd.exe with directions in #2 of this thread, but it doesn't like the syntax. I've tried searching for a batch script GUI but the only one that looks suitable needs gawd awful ActiveX to work and fails dismally on Linux.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.