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. |
19th February 2003, 23:41 | #1 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
CALL command
This might be way over the top, but I am wondering if there exists a method or the possibility of implementation of a CALL command (to call an external commandline program) in AviSynth?
The background for the question is this. My wife does some video editing in Movie Maker 2 and then hands it off to me to finish up in Video Vegas. WMM2 creates a Type 1 DV file that nothing seems to like so I have to convert it, or save out the wav and use wavsource or load it in VDub as separate wav audio. If you have 25 files to do this gets to be a real pain, plus I run into many other situations where I wish I could call an external program. Sort of a batch file mentality I guess. As I was playing around with writing some automatic templates for AVISynthesizer (the real one - the first one), I was struck with how nice it would be to have the ability to call an external program to strip the audio from an AVI as a wav file and then use wavsource. Something like this: #DV-T1 Template Call ("avi2wav.exe mytest.avi mytest.wav") #imaginary V=avisource("mytest.avi") A=wavsource("mytest.wav") AudioDub(V,A) This might also be useful with MPGs and mpasource. I may well be way off target but I sure do wish there was a way to automate this chore from within AviSynth. Am I missing some obvious solution? Add: Another thing that got me thinking about this was Nic's mpegdecoder and mpasource both do/can call a routine before allowing the script to complete. Nic builds a d2v file if needed and mpasource creates an index. So, it does not seem too big a stretch to think an external executable might be able to run from within Avisynth. DD Last edited by DDogg; 20th February 2003 at 02:01. |
20th February 2003, 15:33 | #2 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
Well this went over like a lead ballon. So, let me ask a more straight forward question of the coders:
Is it possible to code a plugin/filter with the single purpose of calling and passing params to a external commandline program? If so, would somebody consider doing it? |
20th February 2003, 16:06 | #3 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Should be easy enough - you could even make it trigger on a certain frame. If someone could device a plugin, I'd be happy to implement it into the core.
__________________
Regards, sh0dan // VoxPod |
20th February 2003, 16:38 | #4 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
sh0dan, thanks for the lifeline I was starting think this suggestion might be a big hairball. Seriously, IMO, the additional flexibility made possible could be well worth an effort on somebody's part.
Some: 1> One could do both pre-process and post-process operations from within a script. 2> It would open (somewhat) AviSynth to anybody that could write a simple program or even a batchfile to accomplish one-off "individual enthusiasms". If some of those one-offs were of greater interest a more experienced coder could refine them. Q: Can a plug-in coder send a string to video output? Like "Executing external command, please wait"? DD Last edited by DDogg; 20th February 2003 at 16:42. |
20th February 2003, 17:18 | #5 | Link | |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
Quote:
MPEGSource opens a new window for a progress bar for instance.
__________________
Regards, sh0dan // VoxPod |
|
20th February 2003, 18:22 | #6 | Link |
VDubMod Devel
Join Date: Oct 2001
Location: Germany
Posts: 824
|
@DDogg, you seem to have a small misconception of avisynth scripts or fell into a small trap of thought. The script is not processed once form start to end like e.g. a bash script on linux, there is no temproal one-command-after-the-other, only a stream of frames so to speak which can be accessed randomly.
The result is that a CALL command could only be (someone correct me if I'm wrong)
Cheers Belgabor
__________________
VirtualDubMod [SourceForge : Tracker/DL] (FAQ, Some rules) Be sure to also download the latest DLL package or get the all inclusive package! Before you post questions, please read the VirtualDub and/or VirtualDubMod FAQ. If you have a bug report or feature request for VirtualDubMod, be sure to read the rules first. We give 100% of your donations to the Open Source community |
20th February 2003, 19:24 | #7 | Link | ||
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
Quote:
Quote:
Seriously, Belgabor, thanks for helping me understand better and thanks for all the work on VDubMod. So ..., now that I am a toady, would you be interested in writing this plugin? Last edited by DDogg; 20th February 2003 at 19:27. |
||
21st February 2003, 10:18 | #8 | Link |
Moderator
Join Date: Oct 2001
Location: England
Posts: 3,285
|
The chances are, for instance with BeSweet, the "call" command would just be doing a ShellExecute or CreateProcess, so the application will popup and have its own progress showing...It may not be the neatest way, but should be enough
Ill whip it up tonight if I get time, but any of the coders here could code it if any of us have 5mins to spair (which I fear we rarely do ) -Nic |
21st February 2003, 11:24 | #9 | Link |
Moderator
Join Date: Oct 2001
Location: England
Posts: 3,285
|
Actually, here you go :
http://nic.dnsalias.com/Call.zip Has the source and a Avisynth 2.5 version as well as the normal Call.DLL I havent really tested it, but someone will be able to fix it if its broken easily. Hopefully the readme.txt will help people use it. Cheers, -Nic ps Thinking about it you probably need it after some sort of source, so use like: LoadPlugin("MPEG2Dec.dll") LoadPlugin("Call.dll") MPEG2Source("e:\rip\movie.d2v") Call("d:\besweet", "0,-1") Call probably has to come after a *Source plugin of some sort |
22nd February 2003, 04:21 | #11 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
@Nic
The -1 works like a top, but if 0 is used the call command is implemented twice. If 0 is used it activates @ frame 0 and also at the EOF as if it were passed 0,-1 as its args. If you close the player before the end it also activates. LoadPlugin("call.dll") LoadPlugin("mpeg2dec.dll") testcmd="besweet.exe -core( -input matrix.ac3 -output matrix.wav )" mpeg2source("Matrix.D2V") Call(testcmd,"-1") It was great to see one could use a variable as the argument. I now more fully understand Belgabor's meaning in the post above. I foolishly ( ) thought this might work as if the MP3 could have been produced before the clip: LoadPlugin("call.dll") LoadPlugin("mpeg2dec.dll") LoadPlugin("mpasource.dll") testcmd="besweet.exe -core( -input matrix.ac3 -output matrix.mp3)" Call(testcmd,"-1") V=mpeg2source("Matrix.D2V") A=mpasource("matrix.mp3") audiodub(V,A) I freely and cheerfully admit to a case of ******* . Be that as it may, I still think people may well find some very interesting uses for CALL. There seems to be a sortof IfThenElse<(kinda) structure that could be used (I think) to change the string of a variable used by CALL? That might open a few more uses. Q: Anybody know enough about the import command to tell/show me how to read in a file and reset some variables? I think that is possible but the manual is pretty light on the subject. Last edited by Guest; 22nd February 2003 at 13:09. |
22nd February 2003, 09:41 | #12 | Link |
Moderator
Join Date: Oct 2001
Location: England
Posts: 3,285
|
Hmmmm. Ill look into that DDogg. Ill make that if your setting it for frame 0 then frame 0 is only called once (I dont believe that its getting called at the end, just that the film is being rewound to the first frame by the encoder)
To make a version of Call that works before encoding begins could be tricky. But then again, If I did everything in the constructor of the filter then that should do it before encoding begins....Hmmmm, ill give it a go later. -Nic |
22nd February 2003, 11:43 | #13 | Link |
Moderator
Join Date: Oct 2001
Location: England
Posts: 3,285
|
Call v1.1
http://nic.dnsalias.com/Call.zip
This version now lets you do: LoadPlugin("call.dll") Call(BlankClip, "lame --decode fatboy.mp3 fatboy.wav", "-2") WavSource("fatboy.wav") which creates fatboy.wav just before WavSource trys to load it Also the "calling frame 0 twice bug" should also be fixed. Cheers & good luck with it, -Nic |
22nd February 2003, 17:09 | #14 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
===> Superman cape to Nic
Wow! This works perfectly: LoadPlugin("call.dll") LoadPlugin("mpeg2dec.dll") LoadPlugin("mpasource.dll") testcmd="besweet.exe -core( -input matrix.ac3 -output matrix.mp3" Call(BlankClip, testcmd,"-2") V=mpeg2source("Matrix.D2V") A=mpasource("matrix.mp3") audiodub(V,A) I had come to think it impossible to do something BEFORE the video event. This adds a new dimension. I'm off to do some expermentation with my head spinning.... Nic, tremendous! DD Last edited by DDogg; 22nd February 2003 at 18:00. |
22nd February 2003, 19:37 | #16 | Link |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
How would you change this command that uses quotes (from BeSweet GUI) to work with the CALL command? Possible?
"BeSweet.exe" -core( -input "Matrix.ac3" -output "matrix.mp2" ) -azid( -c light -L -3db --maximize ) -2lame( -m d -b 192 -e ) -profile( DSPguru_MP2@192kbps ) The manual says: "string: surrounded either by "quotation marks" or by ``TeX?-style quotes''. A text string can contain any character except the terminating quotation mark or double-apostrophe. If you need to put a quotation mark inside a string, use the TeX?-style notation. Alternately, you can use Windows extended-ASCII curly-quotes instead of straight quotes to get around this limitation. I tried replacing the standard double quotes with curly ones “” but that did not work. I don't have a clue what a TeX style quote is. |
22nd February 2003, 19:46 | #17 | Link | |
Guest
Join Date: Jan 2002
Posts: 21,901
|
Quote:
|
|
22nd February 2003, 20:04 | #18 | Link | |
Retired, but still around
Join Date: Oct 2001
Location: Lone Star
Posts: 3,058
|
Quote:
Edit: Nope, this no worky for me (just drops through as if it saw a #): testcmd="``c:\Program Files\DVD2SVCD\BeSweet\BeSweet.exe'' -core( -input ``d:\Matrix\Matrix.ac3'' -output ``d:\Matrix\matrix.mp2'' ) -azid( -c light -L -3db --maximize ) -2lame( -m d -b 192 -e ) -profile( DSPguru_MP2@192kbps )" Not using the quotes seems to work ok. This works fine. testcmd="BeSweet.exe -core( -input Matrix.ac3 -output matrix.mp2 ) -azid( -c light -L -3db --maximize ) -2lame( -m d -b 192 -e ) -profile( DSPguru_MP2@192kbps )" Last edited by DDogg; 22nd February 2003 at 20:20. |
|
22nd February 2003, 20:33 | #19 | Link |
VDubMod Devel
Join Date: Oct 2001
Location: Germany
Posts: 824
|
I think I read somewhere that avisynth also accepts TeX stryle quotes, so that my be the reason why it doesnt work. I belive the quotes for besweet are only needed (like with windows commands) if the argument contains white space. I don't know if avisynth allows to escape quotes in strings, otherwise the plugin has to be modified to replace some special character with "
__________________
VirtualDubMod [SourceForge : Tracker/DL] (FAQ, Some rules) Be sure to also download the latest DLL package or get the all inclusive package! Before you post questions, please read the VirtualDub and/or VirtualDubMod FAQ. If you have a bug report or feature request for VirtualDubMod, be sure to read the rules first. We give 100% of your donations to the Open Source community |
Thread Tools | Search this Thread |
Display Modes | |
|
|