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 > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th March 2003, 14:43   #41  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
Sh0dan, Nic, anybody that might know, a theory question:

Main question - In theory would it be possible for the call command to do multiple tasks while it is in an active state?

Not to distract from the main question and just as a poor example: Say we had a separate file called dothis.call with several actions and execute it with:

call(blankclip,"execute d:\dothis.call","-2")

Contents of external file named "dothis.call" (or marked in a script something like a function?)

dothis.call
# whatever multiple avisynth keywords/actions
NicEcho.exe output some variables
Import something using avisynth import command
internal variable=imported variable
end

Last edited by DDogg; 28th March 2003 at 15:27.
DDogg is offline   Reply With Quote
Old 28th March 2003, 15:47   #42  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
won't Import("mycalls.avs") do the job ?
Bidoche is offline   Reply With Quote
Old 28th March 2003, 15:54   #43  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
er, I am not too swift at this, but I did not think the call command would do an internal command? The import command would have to be done within the call command to cause import to activate at the prescribed place in the video event. I will see if I can figure it out and try. If you have an example in mind it would be appreciated.

/edit After quite a few experiments I do not think it is possible to execute a avisynth internal command like Import from within the CALL command. If I find out different I'll update.

Still looking for "Main question - In theory would it be possible for the call command to do multiple tasks while it is in an active state?", Bidoche?


Last edited by DDogg; 29th March 2003 at 01:46.
DDogg is offline   Reply With Quote
Old 29th March 2003, 11:44   #44  |  Link
bilu
Registered User
 
bilu's Avatar
 
Join Date: Oct 2002
Location: Portugal
Posts: 1,182
Hi Ddogg,

I'm still trying to figure out what you want, but please confirm me if it is this:

(from an old example )

INFO.BAT
=========
del c:\info.avs
for /F "usebackq" %%i IN (`time /t`) DO @echo Time=%%i > c:\info.avs
for /F "usebackq" %%i IN (`date /t`) DO @echo Date=%%i >> c:\info.avs

In AVS script
==============
CALL(BlankClip,"c:\info.bat","49")
Import("c:\info.avs",50)
--> would import at frame 50 ?


I don't know if the script would stop rendering until the CALL command finishes ... it could be the only way to know if it would be safe to import a generated script at a specific time.

Also the Import command seems to load the script to generate the filter graph at start, but it should be possible (Bidoche? ) to modify Import (or use within a funtion that could be applied to a certain frame range, don't know if that's possible) to load an imported script at a specific frame.


Best regards,

Bilu
bilu is offline   Reply With Quote
Old 29th March 2003, 12:28   #45  |  Link
Nic
Moderator
 
Join Date: Oct 2001
Location: England
Posts: 3,285
The parameter passed to Call.dll is just a string, and that string is taken as the main parameter to call CreateProcess with. By giving it an avs file, all that would happen is the avs file would be run and probably Windows Media Player would pop up

Ill think about the best way of outputing the full elapsed time, the script idea could get complex Ill also start to play with the Invoke command in avisynth soon.

Cheers,
-Nic
Nic is offline   Reply With Quote
Old 29th March 2003, 15:52   #46  |  Link
DDogg
Retired, but still around
 
DDogg's Avatar
 
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
This is too long but I'll try to stay focused so the reader will actually stay with me, read it, and answer. A lot of this is assumption on my part so >please< correct me if I am wrong :)

As way of background - Because of the way an avisynth script executes as a video event there is no internal command to set a variable value or execute other commands at a specified point like start of video, Frame XX or EOF. Workarounds are needed to accomplish this.

My post, 6 above this one, creates a report with a StartTime and EndTime in d:\report.txt using Nic's CALL command and new version of NicEcho.exe with the \t addition. A variation could have created a report with StartTime = "20:12:16" and EndTime ="20:12:42". It logically follows to import and calculate elapsed time, or even execute an external processing script, and return variables to the present script for further action.

We start running into problems because the avisynth script does not execute sequentially. In a multiple line statement like:

CALL(BlankClip,"blah","50")
Import("blah.txt")

The import commad cannot be depended on to execute at frame 50, only CALL.

The CALL command can not execute multiple commands sequentially. Nor can it execute internal commands individually or in multiple like (poor example)- CALL (blankclip, "NicEcho.exe d:\report.txt 'Starttime=xx EndTime = xx':Import report.txt:VarA=VarB","-2") (see post 5 bove this one)

This is what my twice, now thrice asked: "Main question - In theory would it be possible for the call command to do multiple tasks while it is in an active state?" was about. Forgetting the internal command for a minute, I was curious about whether CALL could in theory do multiple external commands in a stacked sequence.

Because we only have ONE Start of video event to trigger from, multiple commands in one CALL event would be very handy. If an internal command like Import could be added to the stack it would even better.

I have tried to think of solutions via the CALL command as it may not be realistic to expect any core modifications like the one Bilu mentioned. Sure, I hope to be wrong. If the core team could tie the Import or maybe some other internal commands to SOF, frame XX, or EOF, we would have tremendous added flexibility.

A solution not involving core would be if the call command could execute internal commands like Import and/or "varA = varB". I assume Nic said he was looking at "invoke" to see if this would be possible.

@Bilu, I am trying to stay away from DOS based solutions as they add another layer of kludge and DOS flavors vary from OS to OS.

@Nic - As you and Bilu will no doubt appreciate, this whole dialog is not really about elapsed time. Rather just an example of Disk I/O, external, and hopefully internal commands executed at specified trigger points. My intuition tells me this could allow much additional processing power.

Last edited by DDogg; 29th March 2003 at 19:25.
DDogg is offline   Reply With Quote
Old 9th July 2004, 21:01   #47  |  Link
enterprise
Registered User
 
Join Date: Jul 2004
Posts: 6
Call command

Hi, nic.

I checked your Call Plugin and I think it's amazing! It's exactly what I was looking for.
However I have to reload the avi everytime because once Call command is launched it's not launched anymore until I reload the avi. I think it's because Cache but I don't know how can I fix it. I think that if I compile again AviSynth with a different cache value it would work but I don't know how it could be compiled and also I would want that Call plugin would work on a standar Avisynth.

Could you help me?
enterprise is offline   Reply With Quote
Old 9th July 2004, 21:24   #48  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Exactly what do you want to do?

Call is invoked when the script is loaded, not on a per-frame-basis or anything like that.

Edit:
Okay, I don't know what I'm talking about it. I obviously haven't used Call in awhile and had forgotten it does per-frame-stuff.

Last edited by stickboy; 10th July 2004 at 09:03.
stickboy is offline   Reply With Quote
Old 10th July 2004, 08:11   #49  |  Link
enterprise
Registered User
 
Join Date: Jul 2004
Posts: 6
Thank you for your reply!

I want to execute an external command at specific frame even if I play several times the AVI.


Call("c:\Command.exe", "100")


If I open AVI with Mediaplayer, call command is executed only 1 time at frame 100. but if I play again the AVI, the command is not executed.
I am looking for a way to solve it.
enterprise is offline   Reply With Quote
Old 22nd December 2011, 08:34   #50  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Reviving this ancient thread...

Is this any way to send an apostrophe (') inside an argument without CALL_25.dll converting it to a double quote (")?

I've tried \' and everything I could think of but no luck.
vampiredom is offline   Reply With Quote
Old 25th December 2011, 22:04   #51  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by vampiredom View Post
Reviving this ancient thread...

Is this any way to send an apostrophe (') inside an argument without CALL_25.dll converting it to a double quote (")?

I've tried \' and everything I could think of but no luck.
on DOS-prompt, escape sequence is not \ but ^
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 26th December 2011, 03:03   #52  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
on DOS-prompt, escape sequence is not \ but ^
Nope. Doesn't work either. I believe CALL_25.dll was made to internally translate single-quotes to double-quotes; to make it easier for people to send long strings as arguments without having to triple-quote things in AviSynth. This works great – except, of course, when you want to include single-quotes in the string!
vampiredom is offline   Reply With Quote
Old 26th December 2011, 13:55   #53  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,420
Quote:
Originally Posted by vampiredom View Post
I believe CALL_25.dll was made to internally translate single-quotes to double-quotes; to make it easier for people to send long strings as arguments without having to triple-quote things in AviSynth.
Looking through the thread (original was before my time), it seems people were unaware you could use triple-quotes, or perhaps that facility didn't exist back then. Anyway, I've had a look at the CALL source code and it always translates single-quotes to double-quotes - unfortunately, there is no escape mechanism, so the implementation is badly conceived.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 26th December 2011, 19:53   #54  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Quote:
it always translates single-quotes to double-quotes - unfortunately, there is no escape mechanism, so the implementation is badly conceived
Yeah, unfortunate. I think I will write a "partner" .exe for CALL_25.dll that allows some kind of escape mechanism. Perhaps I could use ^x, followed by a hex character code. (so that ' would be ^x27). Does that sound like a reasonable workaround for this issue?
vampiredom is offline   Reply With Quote
Old 30th December 2011, 21:45   #55  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
CALL_25_Helper

Download

OK, I made this little "helper" app to allow single-quotes (and just about any other funky chars, theoretically) to be passed via CALL_25.dll

The following chars need to be escaped, like such:

Code:
^ -> ^x5E
' -> ^x27
\ -> ^x5C
" -> ^x22
These are then unescaped by my .exe

There is also its buddy-function for AviSynth, CALL_25_Helper(), which does the escaping automatically.

Code:
# Modify the CALL_25_Helper_Dir variable to contain the path to CALL_25_Helper.exe
# This path should end with a trailing slash (or backslash)
# example: 
# global CALL_25_Helper_Dir = "C:/Program Files (x86)/AviSynth 2.5/plugins/"

global CALL_25_Helper_Dir = ""

# CALL_25_Helper()
# Usage examples:
#       CALL_25_Helper("c:\path\to\foo.exe", "argument1 argument2 argument3")
#       CALL_25_Helper("c:\path\to\bar.exe", """-a "quoted string #1" -b "quoted string #2"""")
Note that you need to define the global CALL_25_Helper_Dir so that CALL_25 can find the helper .exe ... so either modify the line in the .avsi or include the "global" statement in the top of your script:

Code:
global CALL_25_Helper_Dir = "C:\Program Files (x86)\AviSynth 2.5\plugins\"
**EDIT**
Note: In reality, only the ' and " chars truly need to be escaped. The reason ^ gets escaped is to avoid any confusion with the escape sequence (though this is improbable). The \ gets escaped only because my .exe will sometimes interpret it as an escape char when passed inside of an argument (such as the case of \", which would be an escaped quote). Safety first.

Last edited by vampiredom; 31st December 2011 at 04:29. Reason: clarification of the escape sequences
vampiredom is offline   Reply With Quote
Old 31st December 2011, 04:14   #56  |  Link
vampiredom
Registered User
 
Join Date: Aug 2008
Posts: 233
Another interesting thing about the CALL_25_Helper ...

Since the command is ultimately being executed by the CALL_25_Helper.exe (instead of directly by CALL_25.dll) it now possible to execute system commands ... and you can omit the full path when the the executable is in the system path. A simple example:

Code:
# Open up a Windows Explorer window @ drive d: from AviSynth
CALL_25_Helper("explorer", "d:")
Nifty.

Last edited by vampiredom; 31st December 2011 at 04:23.
vampiredom is offline   Reply With Quote
Old 15th July 2012, 19:38   #57  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Hi nic, vampiredom or anyone interested and capable of doing this,

is there anyone who likes to help me with this idea:
- Add a clip parameter to call, and make the call plugin first copy the current frame to the clipboard before executing the command
- allow call to execute the command with every frame
- wait for the command to finish, then copy the clipboard content to the return clip (you got it: the command changed the frame in the clipboard)
- maybe add another clip parameter which gives the assumed return clip properties for the graph creation phase of the AviSynth script

The use case I have in mind is to call ImageMagick operations inside an AviSynth script.
Even if it might me slow, all available ImageMagick operations would be accessible at one stroke. I am specifically interested in the fourier and other transform features, which are slow anyway.

The command would be the ImageMagick script, of course, that would start and end reading/writing the clipboard.

Just to allow the command to change the dimensions or other clip properties, it would be useful to give the extended call plugin the 2nd clip as prototype for ImageMagick's return data.

Last edited by martin53; 15th July 2012 at 19:55.
martin53 is offline   Reply With Quote
Old 15th July 2012, 19:55   #58  |  Link
um3k
Registered User
 
Join Date: May 2007
Posts: 220
I wonder if it would be better to use stdin and stdout instead of the clipboard?
um3k is offline   Reply With Quote
Old 15th July 2012, 21:20   #59  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,155
mg262's run_25_dll_20050616 dll WarpEnterprises (Runs a system command. Simple source in text file, very succinct)
__________________
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 ???
StainlessS is offline   Reply With Quote
Old 16th July 2012, 20:14   #60  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Quote:
Originally Posted by StainlessS View Post
mg262's run_25_dll_20050616 dll WarpEnterprises (Runs a system command. Simple source in text file, very succinct)
hmm, indeed, http://avisynth.org/warpenterprises/...l_20050616.zip could be a close to perfect starting point. Today, it just returns the unchanged clip. This would need some work.
martin53 is offline   Reply With Quote
Reply

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 13:44.


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