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 Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th March 2007, 21:01   #601  |  Link
qwerpoi
Registered User
 
qwerpoi's Avatar
 
Join Date: Oct 2002
Posts: 298
Quote:
Originally Posted by Spuds View Post
Finally got a capture of that allusive startup error window !! As Terranigma noted is closes AvsP on startup.
Thanks for the nimble screenshot , and sorry about the bug, I'll have it fixed by the next release. And I'll see what I can do about redirecting the error messages to a text file for cases like these...

Quote:
Originally Posted by Eggroll View Post
Just recently discovered avsP and starting to seize the potential of this application in script editing.

I was wondering if there was a possiblity to store (and access) global variables in a macro so another macro could use a global variable stored in a previous macro?

It could take the form of a key/value dictionary in avsp object that would allow different macros to access the same dictionary and fiddle with previously saved values.

Thanks in advance, keep on the good work.
It's a good idea, but you should be able to implement it already without extra macro functions. Basically use cPickle to dump and load from a file named "vars.dat" (or whatever) which stores your dictionary. Something like this:
Code:
import cPickle
import os

# Load the persistent variables
if os.path.isfile('vars.dat'):
    f = open('vars.dat', mode='r')
    vars = cPickle.load(f)
    f.close()
else:
    vars = {}

# Your macro goes here...
# Access, add, or delete entries to the vars dictionary...
#

# Save the persistent options
f = open('vars.dat', 'w')
cPickle.dump(vars, f)
f.close()
I could possibly add macro functions to wrap this kind of stuff, but it doesn't seem worthwhile to save a couple of lines of code at the expense of reduced freedom. I guess what I'm saying is that in order to use a macro function like this, you'd have to be pretty familiar with Python, and if you're pretty familiar with Python, you already know or can figure out how to use cPickle to store persistent data. Let me know what you think.

Quote:
Originally Posted by krisq View Post
Excellent work qwerpoi, as always .
Something cool came to my mind lately. When you make a preset like
Code:
LeakKernelDeint (order=0, threshold=6, sharp=true, map=false)
it would be nice if we could do something like
Code:
LeakKernelDeint (order=%C, threshold=6, sharp=true, map=false)
where %C is the cursor so that way we could immediatley edit this value without scrolling to it. What do you think?
Interesting suggestion, I'll try and have it in the next release.

Quote:
Originally Posted by Henrikx View Post
@qwerpoi



Update German Translation 1.3.7
You may want to update your translation - starting from this version, you can translate 'Ctrl' to 'Strg' without messing up the keyboard shortcuts (I think 'Alt' and 'Shift' don't need translating on German keyboards, but you can translate those as well).

Quote:
Originally Posted by khs81 View Post
Hi!
At first, I want to thank qwerpoi for the nice job.

Second: we prepared an italian translation for the tool (for the version 1.3.6). You can find it here
Very cool, always nice to have another language. I'll add the link to the first post and the website.
qwerpoi is offline   Reply With Quote
Old 9th March 2007, 01:38   #602  |  Link
Eggroll
Registered User
 
Join Date: Nov 2005
Posts: 14
I don't know python, I happened to research about it. I've been programming for the past 7-8 years, mostly c, c++ and c# so I still understand what's going on without being familiar with python's syntax and all that.

I thought of using a temp file at first but it seemed like an awful lot of mess to create a file (and eventually delete it), possibly dealing with ntfs permission, file lock and all that. I know it's possible and easy to do, but I was looking for a 'cleaner' way of storing temporary variables in memory since it's usually where I'll want to store it anyway.

The problem with a file is that it persists even when the application is closed.

As a temporary solution, I wrote my variables in the clipboard so I don't have to manage files on disk.

Anyways, thanks for your answer, if no change is made, I'll just either use clipboard like I do now or use cPickle. Not my favorite method but it'll work just as good since my purpose is to write macros to ease the creation of script, even at the expense of creating a few intermediary files that the user can clean out whenever it is needed.
Eggroll is offline   Reply With Quote
Old 9th March 2007, 09:27   #603  |  Link
khs81
Registered User
 
Join Date: Mar 2007
Posts: 3
I'm sorry, better correct the link i gave you for the italian translation with the one without the version number included in the namefile, so that the link remains the same also when a new version come out and I post the new translation.

Here you find the new link.

Thanks and sorry for this little mistake
khs81 is offline   Reply With Quote
Old 9th March 2007, 19:09   #604  |  Link
qwerpoi
Registered User
 
qwerpoi's Avatar
 
Join Date: Oct 2002
Posts: 298
Quote:
Originally Posted by Eggroll View Post
The problem with a file is that it persists even when the application is closed.
I misunderstood your first post, I thought you wanted persistence, my mistake. Of course cPickle will still work for what you need, as well as your clipboard solution, but neither is optimal, so I'll see what I can come up for the next version.

Quote:
Originally Posted by khs81 View Post
I'm sorry, better correct the link i gave you for the italian translation with the one without the version number included in the namefile, so that the link remains the same also when a new version come out and I post the new translation.

Here you find the new link.

Thanks and sorry for this little mistake
No problem, I updated the links on the website and first post accordingly.
qwerpoi is offline   Reply With Quote
Old 10th March 2007, 13:09   #605  |  Link
Eggroll
Registered User
 
Join Date: Nov 2005
Posts: 14
I'll be waiting then...


Thanks!
Eggroll is offline   Reply With Quote
Old 10th March 2007, 13:20   #606  |  Link
zemog
Registered User
 
Join Date: Sep 2006
Location: Madrid (Spain)
Posts: 20
@qwerpoi

One more time
Attached Files
File Type: rar Spanish translation v1.3.7.rar (14.1 KB, 91 views)
zemog is offline   Reply With Quote
Old 11th March 2007, 17:39   #607  |  Link
TheRainmaker
Registered User
 
Join Date: Dec 2006
Posts: 45
Quote:
Originally Posted by Spuds View Post
Finally got a capture of that allusive startup error window !! As Terranigma noted is closes AvsP on startup.

If you still got a problem to open AvsP try this;
Delete all of things about AvsP aplication and if you still have zipped file(or download again) extract again in any folder...
It will be work %100...
TheRainmaker is offline   Reply With Quote
Old 12th March 2007, 19:11   #608  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
I've been trying out the new syntax highlighting tools, now that the function definitions are all up-to-date, and I'm loving it! =D I was wondering if you think it'd make sense to highlight the function argument names, and maybe extend the comment background to the edge of the window. It's all pretty smooth, though.

Also, have you had any word about how well avsp runs on *nix systems? Just curious.

Oh, and concerning Python and single-instance, it looks like the budget method is a workable one:
http://mail.python.org/pipermail/pyt...er/057530.html
http://mail.python.org/pipermail/pyt...er/057670.html
But you still have to come up with some method to pass in data, without sockets or COM. In Win32 you can register an event handler to fire when a file or folder is updated, then you could read information out of that and activate yourself, but I have no idea if you could do that in python.
foxyshadis is offline   Reply With Quote
Old 12th March 2007, 20:00   #609  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
French translation updated
Well done, another long and good changelog, and syntax highlighting seems fixed this time! Only one small request: can the syntax highlights have priority on the "Highlight current line" option ? Meaning,when a background color has been defined in some syntaxe highlight, can it stay even when the line is selected (and therefore highlighted)?

The new macro created lots of new inputs with the arguments in the functions definition, that's nice ; do you think it would be possible for it to distinguish between required and optional parameters, and add " for the arguments accordingly ? But maybe this information is not available from avisynth 2.5.7...

I haven't had a chance yet to test the rest of the new features, but they sound very cool in the changelog and your explanations !
Alain2 is offline   Reply With Quote
Old 12th March 2007, 20:22   #610  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Quote:
Originally Posted by Alain2 View Post
The new macro created lots of new inputs with the arguments in the functions definition, that's nice ; do you think it would be possible for it to distinguish between required and optional parameters, and add " for the arguments accordingly ? But maybe this information is not available from avisynth 2.5.7...!
The information is unfortunately not available for avisynth as it is the individually filters that defines what parameter is necessary and they are no way to tell avisynth what parameters that are needed.

foxyshadis: interprocess communication (sockets) is available for python just look at the python docs: http://docs.python.org/lib/ipc.html
also by using ctypes it should be easy to create a mutex to check for only 1 instance of avsp
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 12th March 2007, 21:59   #611  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
He said sockets add a meg to the install though. I was just trying to think of hackish ways of doing it to keep the size down.

Alain, in plugins, all named arguments are optional, required ones can't have names in avisynth. It's nice to manually enter the required names, though, and then you would need that. TO get the macro to do that for you, change:
Code:
                   arglist=arglist+" "+namedargname
to
Code:
                   arglist=arglist+' "'+namedargname+'"'
And then change overwriteAll to True on the bottom, rerun it, and you should have quoted args. Good idea btw.

Last edited by foxyshadis; 12th March 2007 at 22:04.
foxyshadis is offline   Reply With Quote
Old 13th March 2007, 00:20   #612  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Quote:
Originally Posted by foxyshadis View Post
He said sockets add a meg to the install though. I was just trying to think of hackish ways of doing it to keep the size down.
okay didn't see that. So using ctypes to access the windows API IPC function would be a solution (and rather hackish too )

Quote:
Alain, in plugins, all named arguments are optional, required ones can't have names in avisynth. It's nice to manually enter the required names, though, and then you would need that. TO get the macro to do that for you, change:
Code:
                   arglist=arglist+" "+namedargname
to
Code:
                   arglist=arglist+' "'+namedargname+'"'
And then change overwriteAll to True on the bottom, rerun it, and you should have quoted args. Good idea btw.
sorry it is only true for the build-in filters. As an example try compiling this filter:
Code:
AVSValue __cdecl CreateExample(AVSValue args, void* user_data, IScriptEnvironment* env) {
int i=args[1].AsInt(1) ;//default is supplied so even if it is not named it is optional
return args[0].AsClip();//no default so required even if it is a named arg.
}

extern "C" __declspec(dllexport) const char* __stdcall AvisynthPluginInit2(IScriptEnvironment* env) {
env->AddFunction("Example", "[required]ci", CreateExample, 0);
}
The filter created would take this syntax "Example(clip required, int)". the named argument "required" is needed as there are no default value while the unnamed argument int is optional because a default value is provided.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 13th March 2007, 04:00   #613  |  Link
qwerpoi
Registered User
 
qwerpoi's Avatar
 
Join Date: Oct 2002
Posts: 298
Quote:
Originally Posted by zemog View Post
@qwerpoi

One more time
Thanks for the translation update, I updated the links accordingly.

Quote:
Originally Posted by TheRainmaker View Post
If you still got a problem to open AvsP try this;
Delete all of things about AvsP aplication and if you still have zipped file(or download again) extract again in any folder...
It will be work %100...
Yes, you're right, you only need to delete _last_session_.ses for things to work. The problem is is that if you have scripts with unicode in them, it's possible for the issue to come up again. I'll try and have this bug squashed once and for all in the next release.

Quote:
Originally Posted by foxyshadis View Post
I've been trying out the new syntax highlighting tools, now that the function definitions are all up-to-date, and I'm loving it! =D I was wondering if you think it'd make sense to highlight the function argument names, and maybe extend the comment background to the edge of the window.
Some good suggestions, I'll see what I can do.

Quote:
Originally Posted by foxyshadis View Post
Also, have you had any word about how well avsp runs on *nix systems? Just curious.
Although wxPython is cross-platform, AvsP uses some windows-specific functions, particularly in the video display code, which calls up on avifil32.dll and msvfw32.dll via the ctypes python package (although currently the display code is being rewritten by tsp to utilize avisynth.dll instead of avifil32.dll...). The display code is pretty well separated, so making AvsP cross-platform shouldn't be too much work (in theory). Of course, unless I'm missing something, it's not an issue until Avisynth 3.0 comes out. Whenever that happens, the display code can be rewritten to utilize the interfaces that Avisynth 3.0 would provide.

Quote:
Originally Posted by foxyshadis View Post
Oh, and concerning Python and single-instance, it looks like the budget method is a workable one:
http://mail.python.org/pipermail/pyt...er/057530.html
http://mail.python.org/pipermail/pyt...er/057670.html
But you still have to come up with some method to pass in data, without sockets or COM. In Win32 you can register an event handler to fire when a file or folder is updated, then you could read information out of that and activate yourself, but I have no idea if you could do that in python.
Thanks for the info, I'll give it a look over. And yes, you should be able detect when a file or folder is activated in python using ctypes and win32 itself (here's a link if you're curious). Of course, that would be adding even more windows-specific code...

Quote:
Originally Posted by Alain2 View Post
Only one small request: can the syntax highlights have priority on the "Highlight current line" option ? Meaning,when a background color has been defined in some syntaxe highlight, can it stay even when the line is selected (and therefore highlighted)?
Thanks for the translation update. As far as highlighting priority is concerned, I'm not sure if it's possible, but I'll check it out.

Quote:
Originally Posted by Alain2 View Post
The new macro created lots of new inputs with the arguments in the functions definition, that's nice ; do you think it would be possible for it to distinguish between required and optional parameters, and add " for the arguments accordingly ? But maybe this information is not available from avisynth 2.5.7...
I don't know too much about AviSynth's internals, so whatever tsp and foxyshadis said . Perhaps if we're looking to the future, it would be possible to enforce plugin design in Avisynth 3.0 to specify which arguments are defaults and which are required, and furthermore specify ranges of allowable values for each argument, which would lead to the ability to automatically create user sliders for each filter. Which is not an important feature to me, but people seem to like going crazy with those user sliders .
qwerpoi is offline   Reply With Quote
Old 13th March 2007, 06:03   #614  |  Link
Veiga
Registered User
 
Join Date: Oct 2006
Posts: 12
@qwerpoi




Portugues translation release for v1.3.7
Attached Files
File Type: zip Portugues_BR_v1.3.7__translation.zip (13.1 KB, 95 views)
Veiga is offline   Reply With Quote
Old 13th March 2007, 18:08   #615  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Quote:
Originally Posted by tsp View Post
The filter created would take this syntax "Example(clip required, int)". the named argument "required" is needed as there are no default value while the unnamed argument int is optional because a default value is provided.
That is true, although in practice the convention almost always holds. I can only think of a couple of filters with any required named arguments, and none with optional unnamed. (Most languages with named arguments don't support that, too much confusion in parsing.) Good point, though.

Short of avisynth further extending the filter argument list, I guess there's no fullproof way to analyse it for optional/required, then.
foxyshadis is offline   Reply With Quote
Old 15th March 2007, 06:45   #616  |  Link
nibbles
Registered User
 
nibbles's Avatar
 
Join Date: Aug 2006
Posts: 50
Quote:
Originally Posted by qwerpoi View Post
* added pixel position and color information to status bar (suggested by nibbles, jmac698)

Absolutely fantastic. I really appreciate the feature for updating the function defs based on 2.5.7.
Your app works so well, on one of my computers, I was still using v1.2.1.

I have a macro question if anyone has a few minutes. I have an avs script that starts off like this:
Code:
c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
What I've done is write a macro that when activated adds a
Code:
c2=c2.DeleteFrame(1234)
type of command in that script. Once I delete a frame from c2 for instance, I was hoping I could add some python code to my macro that reads in the second line and adds 1 to the Trim command final frame value so that the total number of frames is unchanged, like this:
Code:
c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,143196).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
But I have no idea how to parse the line and add 1 to the value.
Ok thanks for all you've done. Have a great week!
nibs
nibbles is offline   Reply With Quote
Old 15th March 2007, 18:28   #617  |  Link
qwerpoi
Registered User
 
qwerpoi's Avatar
 
Join Date: Oct 2002
Posts: 298
Quote:
Originally Posted by Veiga View Post
Portugues translation release for v1.3.7
Thanks for the translation update, I updated the links on the first post and website accordingly.

Quote:
Originally Posted by nibbles View Post
What I've done is write a macro that when activated adds a
Code:
c2=c2.DeleteFrame(1234)
type of command in that script. Once I delete a frame from c2 for instance, I was hoping I could add some python code to my macro that reads in the second line and adds 1 to the Trim command final frame value so that the total number of frames is unchanged, like this:
Code:
c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,143196).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
But I have no idea how to parse the line and add 1 to the value.
Hmm, this is not the easiest of tasks. Unfortunately, currently there's no way to replace sections of the text with macros, but it shouldn't be difficult to add to the next version. In the meantime, you can try something like this. Change your script to be:
Code:
x = 143195

c1=AVISource("K:\B\1.avi", audio=true, pixel_type="YUY2").Trim(4,143101).Crop(8,0,-8,-10,true)
c2=AVISource("J:\B\2.avi", audio=true, pixel_type="YUY2").Trim(97,x).Crop(8,0,-8,-10,true)
c3=AVISource("J:\B\3.avi", audio=true, pixel_type="YUY2").Trim(97,143195).Crop(8,0,-8,-10,true)
where "x = 143195" is the very first line of your script (note the change "Trim(97,x)" in the c2 line). Then you can use this simple macro:
Code:
avsp.InsertText(' + 1', pos=(0,-1))
which will add a " + 1" to the end of the first line every time you run the macro. Note that the line "x = 143195" must remain in the same place, but does not need to be on the first line - if it was the 10th line then you would use a pos=(9,-1), etc. Not the prettiest solution if you plan on running this macro hundreds of times, but otherwise it gets the job done. I'll try and have some macros for positioning and replacing in the next version, but keep in mind that even with the ability to replace sections, a macro like this will likely be fragile (ie, might not work properly if you add lines to the beginning of the script, or change the name of variables, etc.) If anyone has a more clever solution, feel free to jump in.

Last edited by qwerpoi; 15th March 2007 at 18:34.
qwerpoi is offline   Reply With Quote
Old 15th March 2007, 20:00   #618  |  Link
nibbles
Registered User
 
nibbles's Avatar
 
Join Date: Aug 2006
Posts: 50
Hey that'll work perfectly. Unless somebody else wants positioning
and replacement macros, I'm set with what you just posted.
That is really gonna shine!
nibbles is offline   Reply With Quote
Old 17th March 2007, 12:43   #619  |  Link
Alain2
Registered User
 
Join Date: May 2005
Posts: 236
Features request:
- Possibility to have the main script window "always on top" (especially when having set the video as a separate window ; coiuld be useful as well when using an external player, but personnally it's the interaction between the script and video windows that I am interested in)
- Option to limit the max width of the video (to say for instance for me 1550, as my screen resolution is 1600x1200) when using the auto zoom. That way I won't have to resize the video window for every different script I have, I would just expand to fullscreen the video window and always have the same video dimension for all my scripts..

Last edited by Alain2; 17th March 2007 at 13:48.
Alain2 is offline   Reply With Quote
Old 24th March 2007, 20:42   #620  |  Link
jubilex
Registered User
 
Join Date: Feb 2007
Posts: 50
nevermind...

Last edited by jubilex; 24th March 2007 at 20:59.
jubilex 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 00:49.


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