View Full Version : "Autosensing" scripting based on compressibility?
bilu
4th March 2003, 23:53
Looking at the concepts of the CALL command (http://forum.doom9.org/showthread.php?s=&threadid=46506) ,XVID debug output (http://forum.doom9.org/showthread.php?threadid=47752), something like the XVID Analizer (http://forum.doom9.org/showthread.php?threadid=44822) and this info on Avisynth site:
AVS-files:
Just import it at the beginning of your script:
Import("d:\filename.avs")
In v2.05 or more recent version you can use the autoplugin loading. Just move your AVS-file in the plugindir :containing the other (external) plugins, and rename the extension to 'avsi'.
It would be possible to generate new resize/denoise scripts aiming for a range of compressibility values in a "autosensing" way.
Conditional import of AVS files based on a prior result of compressibility analisys (choosing a lower quality preset if comp.check would be too low and higher if it would be too high) and somehow stopping if you get into range doesn't sound that absurd to me. :)
Your opinions?
Best regards,
Bilu
bilu
5th March 2003, 13:05
@sh0dan
I think it can be a very good idea to write preset scripts to increase/decrease compressibility, that could be changed by using the CALL command to copy over an AVS file to be loaded by Import ("d:\filename.avs").
But I can't use Avisynth this way, can I? It seems I have to use Import at the beginning of the script.
Best regard,
Bilu
stax76
5th March 2003, 23:51
I have problems to fully understand what you plan
to do but did you test the latest DVX version
RC 27, it features a macro called compressibility,
could be useful for your auto resize script.
As you know there is a AutoCrop filter so the only
thing missing to make everything auto is a general
purpose auto deinterlace filter/function for lamers
like me who are to lazy to learn about deinterlacing
sh0dan
6th March 2003, 09:15
A much better way would be for a GUI to incorporate this. Gordian Knot and DVX seems like nice places to do that - DVX probably being the most realistic (as it is still under much development).
bilu
6th March 2003, 12:23
@Dolemite
I've installed and looked and DVX for the first time, but I can't try it until the weekend. It looks very good. By the way, how do you IVTC, with AVS or DVD2AVI ?
@Sh0dan
I was aiming for a compressibility test entirely made from AVS scripts and batch files :rolleyes:
Better yet, the "autosensing" concept was to change resize and C3D settings using presets, based on the compressibility result, until we got into the 60%-75% range, displaying an error message if it could not be done, and starting to encode the entire movie with the settings used in the last comp.test if within range. It could save a lot of user trial-and-error by doing it automatically :D
Is there a way to pass variables from on AVS script to another with Import("file.avs")?
@both
Do you think this could be a good idea to implement in a GUI?
Best regards,
Bilu
jonny
6th March 2003, 14:39
I was aiming for a compressibility test entirely made from AVS scripts and batch files
The main problem here is to automatically calculate the size of the first pass... it's not possible to retrive this info via avisynth afaik (even making an external program and calling it via CALL command)
A gui is the only solution imho.
(if you want to make batch analisys for xvid, soon you'll have a nice surprise ;))
DDogg
6th March 2003, 15:38
Is there a way to pass variables from on AVS script to another with Import("file.avs")?
I feel your pain :) I have asked the same question twice and received no answers. I have never seen it used in a script or mentioned except the one line in the docs. If we had the ability to import variables, and better yet, the additional basic ability to output variable values to textfile, IMO, it would open up a whole lot of additional flexibility. Alas, I think the developers think us crazy, don't understand the need, or have no interest (maybe it is us that don't understand the full picture). That's the price you pay when you have ideas, but can't code yourself, always the beggar.
I hope you continue to work on this idea. Maybe some other things could come from it as you work on it.
DD
Wilbert
6th March 2003, 15:56
Forgive me if I don't understand what you mean/want. But the variables/functions you defined in file.avs can be used in an other script after importing file.avs. For example:
Make a file.avs containing:
width = 640
height = 272
Make another script, for example:
Import("c:\file.avs")
clip = AviSource("c:\video.avi")
clip.BicubicResize(width, height)
I guess this should work.
bilu
6th March 2003, 16:06
This could be an example of how to create an AVS script with the filesize for later importing:
cd /d c:\
del /q c:\filesize.txt
for %%I in (c:\movie.avi) do @echo %%~zI > c:\filesize.txt
for /f "tokens=1" %%I in (c:\filesize.txt) do set filesize=%%I
del c:\avstemp.avs
echo filesize=%filesize% >> c:\avstemp.avs
Should work on W2K and XP.
But still I dont know if we can pass variables between AVS scripts :(
Wilbert, you posted first :)
Bilu
bilu
6th March 2003, 16:16
Well, if we can pass variables, use CALL to create a custom AVS script, and import them later, then there are lots of open possibilities unexplored in Avisynth! :D :D :D
@Wilbert and Sh0dan
Another question: can you pass Avisynth variables to a CALL command ?
I have reread the thread, looks like we can. (http://forum.doom9.org/showthread.php?s=&threadid=46506&pagenumber=1)
Best regards,
Bilu
Wilbert
6th March 2003, 16:47
I guess you want to evaluate variables, convert them to strings and concatenate these.
Just a stupid example, suppose you want to do this:
x = 384/2
s="BeSweet.exe -core( -input Matrix.ac3 -output matrix.mp2 ) -azid( -c light -L -3db --maximize ) -2lame( -m d -b x -e ) -profile( DSPguru_MP2@192kbps )"
with x the bitrate.
Info: http://www.avisynth.org/index.php?page=ScriptFunctions, read this!
First you have to evaluate x, thus:
y=Eval("x")
it will return 192. Make your strings (make sure to include empty spaces if necessary):
str1 = "BeSweet.exe -core( -input Matrix.ac3 -output matrix.mp2 ) -azid( -c light -L -3db --maximize ) -2lame( -m d -b "
str2 = String(y)
str3 = " -e ) -profile( DSPguru_MP2@192kbps )"
concatenate them:
s = str1+str2+str3
Finally:
BlankClip = ...
Call(BlankClip, s, "-1")
I hope you got the idea.
bilu
6th March 2003, 17:23
@Wilbert
Yes I know, I posted these ;) :
http://www.avisynth.org/index.php?page=ResizeARC
http://www.avisynth.org/index.php?page=CompTest
Best regards,
Bilu
Wilbert
6th March 2003, 18:00
Ah, I remember again. Sorry I have to ask:
function Comptest(clip c, int percent) {
frange=floor(eval(string(c.framecount)+".*("+string(percent)+"./100.)"))
return eval("SelectRangeEvery(c,"+string(frange)+",14)")
}
Usage: Comptest(5)
For a compressibility test on 5% of the movie.
What don't you simply do:
function Comptest(clip c, int percent) {
frange=c.framecount*percent./100
return SelectRangeEvery(c,frange,14)
}
idem for ResizeARC.
DDogg
6th March 2003, 18:05
@bilu, I think this question is enough on the same lines as not to constitute a Hijack. Hope you do not mind. Add: BTW, In some PM's Nic said he would work on the passing of quotes in CALL when the mood hit him again. I think this is going to turn out to be an important.
@Wilbert, et all,
Let me throw this out. After reading your reply, perhaps there is a way to do this. I thought if anybody would know, it would be you.
How would you output a text report to disk with something like the following values after a script run:
--------------------------------
Report on c:\mywork\mytest.avi
Total framecount = 68000
Framerate = 29.97
Width = 720
Height = 480
Total Processing Time = 20m:07s
--------------------------------
addition: If the time function is impossible so be it, just outputting variable values to a text file (with the potential to re-read them back in) is what I am really interested in.
bilu
6th March 2003, 20:28
@Wilbert
You're right. You (or everyone else) can correct it you if want, because you can :). Wiki is wonderful.
I won't have the time until the weekend.
Bilu
Wilbert
7th March 2003, 10:25
@Wilbert, et all,
Let me throw this out. After reading your reply, perhaps there is a way to do this. I thought if anybody would know, it would be you.
Don't give me too much credits, I don't know anything about programming. I hope that Bilu or Sh0dan can help you :)
WarpEnterprises
7th March 2003, 13:52
outputting and reading back to and from a file is not that hard if you can rely on the C sprintf syntax.
Maybe give some more ideas for what such a feature could be used.
e.g. if the variable should be in the file or not.
And what is a little more tricky is to decide WHEN the info is written (e.g. on exit, on start, if frame=n)
READ can only be meaningful at the startup (initialising) of the script.
But maybe some of the more experienced devs have additional ideas.
DDogg
7th March 2003, 17:26
I think I answered my own question with help from Nic who wrote the CALL command.
http://forum.doom9.org/showthread.php?s=&threadid=46506
I had started to think CALL could not access command.com commands and I am sure happy to be incorrect :) It seems we now have Disk output to use for a whole slew of things like reportage, the saving of variables for later reuse, the on the fly creation of AVS scripts that bilu is focusing on, and I am sure a dozen other things we have not thought of.
I can't say it better than what bilu wrote above:
Well, if we can pass variables, use CALL to create a custom AVS script, and import them later, then there are lots of open possibilities unexplored in Avisynth!
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.