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 12th December 2003, 04:52   #1  |  Link
jcsston
Matroska Dev
 
jcsston's Avatar
 
Join Date: Sep 2002
Location: Texas, USA
Posts: 230
Get the current script filename

Is it possible to get the filename of the current AVS script file inside a filter?
I want to make a Audio Normalizing filter that caches the the peak levels to an external file so that it only has to scan it once.
__________________
The Matroska Effect
jcsston is offline   Reply With Quote
Old 14th December 2003, 22:23   #2  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
Is seems that this is not exposed in the API.
WarpEnterprises is offline   Reply With Quote
Old 15th December 2003, 19:15   #3  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
function GetScriptName() {
Try { NonExistantfiltername() }
Catch(err_msg) {
err_msg2 = MidStr(err_msg, 67)
filename = LeftStr(err_msg2, (FindStr(err_msg2, ", line")-1))
return filename
} }
mf is offline   Reply With Quote
Old 15th December 2003, 19:48   #4  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
Whaouh, mf saves the day !
Bidoche is offline   Reply With Quote
Old 15th December 2003, 20:00   #5  |  Link
jcsston
Matroska Dev
 
jcsston's Avatar
 
Join Date: Sep 2002
Location: Texas, USA
Posts: 230

I went ahead and made the filter but it takes the peak value file as an argument.
Normalize2

Now with mf's function I can get similar results to what I wanted.
Code:
function GetScriptName() {
Try { NonExistantfiltername() }
Catch(err_msg) {
err_msg2 = MidStr(err_msg, 67)
filename = LeftStr(err_msg2, (FindStr(err_msg2, ", line")-1))
return filename
} }
...
Normalize2(GetScriptName()+".norm")
__________________
The Matroska Effect
jcsston is offline   Reply With Quote
Old 15th December 2003, 20:10   #6  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Glad I could be of help .
mf is offline   Reply With Quote
Old 15th December 2003, 21:37   #7  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,267
Quote:
Originally posted by mf
function GetScriptName() {
Try { NonExistantfiltername() }
Catch(err_msg) {
err_msg2 = MidStr(err_msg, 67)
filename = LeftStr(err_msg2, (FindStr(err_msg2, ", line")-1))
return filename
} }
That's sick.

But it won't work for the contrived case where the filename has ", line" in it. Here's a modified version (and that also isn't dependent on NonExistentFilterName):
Code:
function GetScriptName()
{
    Try
    {
        assert(false)
    }
    Catch(err_msg)
    {
        err_msg = MidStr(err_msg, FindStr(err_msg, "(") + 1)
        filename = LeftStr(err_msg, StrLen(err_msg) - FindStr(RevStr(err_msg), ","))
        return filename
    }
}

Last edited by stickboy; 15th December 2003 at 21:40.
stickboy is offline   Reply With Quote
Old 15th December 2003, 22:17   #8  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Well, you know I like to write dirty code .
mf is offline   Reply With Quote
Old 16th December 2003, 21:00   #9  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
you are VERY creative !
WarpEnterprises is offline   Reply With Quote
Old 16th December 2003, 21:49   #10  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Quote:
Originally posted by WarpEnterprises
you are VERY creative !
Me, Pamel or stickboy?
mf is offline   Reply With Quote
Old 16th December 2003, 22:42   #11  |  Link
WarpEnterprises
C64
 
WarpEnterprises's Avatar
 
Join Date: Apr 2002
Location: Austria
Posts: 830
who is Pamel??

doesn't matter, it fits to all of you
WarpEnterprises is offline   Reply With Quote
Old 17th December 2003, 07:01   #12  |  Link
Atamido
Seņor Member
 
Atamido's Avatar
 
Join Date: May 2002
Location: Austin, Texas
Posts: 915
Quote:
Originally posted by WarpEnterprises
who is Pamel??
Yo, did somebody call?
Atamido is offline   Reply With Quote
Old 17th December 2003, 10:00   #13  |  Link
mf
·
 
mf's Avatar
 
Join Date: Jan 2002
Posts: 1,729
Whoops! I meant jcsston. Both matroska monkeys .
mf is offline   Reply With Quote
Old 18th December 2003, 10:22   #14  |  Link
Si
Simply me
 
Si's Avatar
 
Join Date: Aug 2002
Location: Lancashire, England
Posts: 610
I'm a bit confused as usual

I understand the GetScriptName function (hats off to mf) but I don't understand what Normalise2 is doing with it and what is meant by caching so it only has to scan the file once

I'm sure its simple but the usage has got me stumped

regards
Simon
Si is offline   Reply With Quote
Old 18th December 2003, 11:28   #15  |  Link
Bidoche
Avisynth 3.0 Developer
 
Join Date: Jan 2002
Location: France
Posts: 639
I guess it uses the script filename to create another one and save into it the audio peak value.
So if that second file exists, no need to scan anymore.
Bidoche 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 19:37.


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