Back Forum Reply New

Import execution at start and end

It was suggested to start a thread here (At least I think it was).

Request:
Execution of Import command at specified frame number OR trigger at before start and after end of video event. Plenty of background in my last post in CALL command.  Object is to use IMPORT in concert with CALL command.

Question: Is there a possibility of extended CALL function being included in core with extended syntax to allow stacked execution of external and internal commands before and after video event?

As per your request, I cannot see it being done in any way, without a major rewrite of AviSynth. Imports must be done at script parse time - no way around that. The only way to do this is for the client application to open the script, and reopen it after the specified frame has been delivered.

What would you be using this for anyway?

Iirc call executes an external program, why not add functions/commands? This way you'd just have to wrap whatever your imported script does into a function and give that to call.

But Call is executed at parse-time, no ?

It seems to me that CALL marks itself as part of the graph to be executed at a certain frame, much like a trimmed source.

But CALL executes external functions and you can import their output later. We could have an adapted Import function that could trigger at a certain frame, like

Import(quot;c:\file.avsquot;, 2000)

that would behave like (sorry for the syntax, i'm @work now)

vid1=avisource(quot;file.aviquot;).trim(0,1999)
vid2=avisource(quot;file.aviquot;).trim(2000,0).Blur(1.5)
vid=vid1+vid2

return vidBilu

...
If you can do it with a script, why a delayed Import ?

No reason at all.

Currently the only way to use the output of a CALL command is like thisoadPlugin(quot;call.dllquot;)
Call(BlankClip, quot;lame --decode fatboy.mp3 fatboy.wavquot;, quot;-2quot;)
WavSource(quot;fatboy.wavquot;)

OR

Autocrop(mode=2,wMultOf=16,hMultOf=16,threshold=40)
Call(quot;cmd /c copy D:\autocrop.log D:\crop.avsquot;,quot;-2quot;)
import(quot;D:\avs_filters\avs25\tests\analyse\crop.avsquot;) quot;-2quot; will make CALL execute before encoding, and that is the only way to use external values in Avisynth currently.

Until 3.0 (at least) it seems we can't expect any kind of quot;triggersquot;.Best regards,
Bilu

And unless you explain exactly what you want and why it is needed, there won't be anything either in 3.0.Besides this quot;-2quot; is particularly cryptic, I think I will add a 6th parameter type in 3.0, namely 'symbolic', in order to have something more readable (The parser/linker will take of converting symbols to ints)

@Bidoche

Using per frame conditional filtering: here and here.

Also check WHILE function in Avisynth and Sh0dan's feature request Best regards,
Bilu

flow control is already considered for 3.0, and I don't see the connection here.
We were talking about CALL.

Originally posted by DDogg
It was suggested to start a thread here (At least I think it was).

Request:
Execution of Import command at specified frame number OR trigger at before start and after end of video event. Plenty of background in my last post in CALL command.  Object is to use IMPORT in concert with CALL command.

Question: Is there a possibility of extended CALL function being included in core with extended syntax to allow stacked execution of external and internal commands before and after video event?

I think Ddogg's request is flow control. CALL would become some sort of work around until 3.0 . I may be wrong on my interpretation  

I didn't understand his question though...  

Bilu

I agree with you, the point is I don't understand what he really wants.

@Sh0dan, first, I sense I have been an irritant to you. Please allow me to start fresh. I'll try to make my chaotic thinking style more precise in the future.What would you be using this for anyway?

Please work with me and read my last post in CALL command for the not very elegant workarounds I am trying to use. Please also see about six posts above the last (March 27) for report example showing events can be made to happen before Frame 0 and after EOF with CALL.

Task (just an example):
1gt; Pre frame 0 - output to disk file report.txt StartTime=quot;xx.xx.xxquot;
2gt; After EOF - append to report.txt EndTime=quot;xx.xx.xxquot;
Above is now possible using CALL and NicEcho.exe
3gt; At EOF Import report.txt, get variables into avisynth, compute ElapsedTime, append to report.txt ElapsedTime = quot;xx.xx.xxquot;.

This is what my last post in the call command thread addresses. Nic hinted the quot;invokequot; command might allow him to execute an internal avisyth command like Import from within CALL.

Qunno, what does devel think? I could never get any feedback from you guys (maybe 'cause I was too pushy, sorry).

Frankly I don't think I/we see all the new possibilities this would allow, but eventually, my hope is to be able to /edit at pre during or post frame event/edit import an external AVS or CALL an external standalone program, separately or in concert, for pre-processing/compression analysis/various calculations/multiple test iterations, reportage, etc.  

Q:This strikes me as a worthy goal, what do you guys think?
I think Ddogg's request is flow control. CALL would become some sort of work around until 3.0
Yes, an expanded CALL command incorporated in 2.5 core or as plugin that allowed multiple external and internal commands to be executed in sequence while WITHIN the call event would allow much additional flexibility. Call allows execution at before, during and after frame events (just my wording). This is what I am looking for.

Q:I just don't know if it would ever be possible for CALL to execute an internal avisynth command. Until I do know, my thinking will always be less than clear.

This should really be the job of the client IMO.

You can already print out the start and end times - couldn't Call just have an append feature, so all times will be written?

lt;sighgt; lol, I give up!  There were some questions above.

/edit The point is to be able to get the variables that reside in an external file back into Avisynth at a given time so that they can be operated upon and further actions be triggered (like with the call command).

@Ddogg

Don't give up and leave me alone... please!  

I think I've understood what you meant  here.

You want to execute multiple commands inside CALL, to

1)output end time;
2)import start time;
3)calculate elapsed time;
4)output elapsed time;

The problem seems to be using the end time output of CALL command.Even if CALL were used just before the last frame (not too much inaccuracy and still within the graph, so we could make the elapsed time calculation) you couldn't use the end time output EVEN if it could be directly passed to an internal variable.

Even if you did:

vid1=avisource(quot;file.aviquot;).trim(0, lastframe -1).Call(whatever,lastframe-1)
vid2=avisource(quot;file.aviquot;).trim(lastframe -1,0).elapsedtime().Call(elapsed_report,-2)

vid=vid1+vid2

return vidbeing elapsedtime() your calculations, how could you import the end time value? And if the end time were passed to an internal variable at lastframe-1, would it work? (Sh0dan,Bidoche?)Bilu

Some precision :
Actually the parser vartable and the environnement vartable are the same. (Correct me if I am mistaken)

Personally I don't think it's normal, script variables should be lost at the end of the parsing.
So they will be independant in 3.0 (unless someone is very very convincing).
If you want to tune things with variables you can have filters play with the environment vartable.

Originally posted by Bidoche
If you want to tune things with variables you can have filters play with the environment vartable.

OK, but that would mean that any calculation would need to be done inside a filter and not on the script, right?

Maybe the most flexible way (if Avisynth can render more than on script at a time) would be creating a new script with a blank clip to

- import start and end time
- make the calculations
- output elapsed time through CALL

After all, start and end times were rendered in the parent script already.  

But we would need to make CALL execute another Avisynth script. Is it possible?  Bilu

I'm going to give this my best shot but I hope this example does not cause confusion of the bigger grail of external pre-processing and analysis which requires Importation of results and then conditional action based upon an evaluation from within AviSynth. Hey, this is NOT about elapsed time, that is just an example.

1gt; Call gives us an envelope to do something before and after the video event (again just my wording. Probably poor).
2gt; The problem arises that Import is not a command that CALL can execute nor is there a way, to the best of my present knowledge, to cause Import to execute dependably in sequence (directly after) the Call event.

Presently we can:
Call event (-2 trigger) (before video)    Write StartTime=quot;xx.xx.xxquot; to external disk file
Call event (-1 trigger) (after last frame - EOF)    Append EndTime=quot;xx.xx.xxquot; to external disk file

So now we have a report.txt that contains:
StartTime=quot;xx.xx.xxquot; EndTime=quot;xx.xx.xxquot;

What I hope for:
Call event (-2 trigger) (before video)    Write StartTime=quot;xx.xx.xxquot; to external disk file
Call event (-1 trigger) (after last frame - EOF)    #Multiple actions executed in sequence    Append EndTime=quot;xx.xx.xxquot; to report.txt    Import report.txt    ElapsedTime=Math operations on variables StartTime and EndTime     append ElapsedTime=quot;xx.xx.xxquot; to report.txt     
Earnest Request: Bidoche, Sh0dan, could you look at Nic's code and/or at least his concept and state whether you think it is possible or impossible for CALL to execute an internal command? This is probably the answer I should have waited for before even attempting this discussion. If the answer is impossible, then it may well be that this whole discussion is moot.

/edit I asked about import at specified frame number because if Call can not do an internal command then an Import at specified frame or SOF/EOF would (I think) do a lot of the computation and automatically set variable when imported as the imported script executes as part of being imported.

Originally posted by DDogg
I asked about import at specified frame number because if Call can not do an internal command then an Import at specified frame or SOF/EOF would (I think) do a lot of the computation and automatically set variable when imported as the imported script executes as part of being imported.

I think the imported script becomes part of the original script when the filter graph is rendered, just at the beginning.

Bilu
¥
Back Forum Reply New