Quantcast Avisynth: Importing AVS and Assigning to a Variable. - digitalFAQ.com Forums [Archives]
  #1  
08-14-2005, 05:31 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Is there any way to import an avs script wich its result is a video and assign it to a variable:

video=import("MyVideo.avs")
last=video

I tryed this but it doesn't work.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
08-14-2005, 06:36 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
Originally Posted by Prodater64
Is there any way to import an avs script wich its result is a video and assign it to a variable:

video=import("MyVideo.avs")
last=video

I tryed this but it doesn't work.

video=import("MyVideo.avs")
return video
Reply With Quote
  #3  
08-14-2005, 06:56 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Quote:
Originally Posted by Prodater64
Is there any way to import an avs script wich its result is a video and assign it to a variable:

video=import("MyVideo.avs")
last=video

I tryed this but it doesn't work.

video=import("MyVideo.avs")
return video

Code:
ping=import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(1,15,1,"ping")
pong=import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(1,15,1,"pong")
return ping++pong

function slicer(clip input,int percent,int Goplenght,int Gopmulti,string "ping")
{
PercCount=(Framecount(input)/100)*percent
period=int(Framecount(input)/PercCount)*(Goplenght*Gopmulti)
input=(ping=="pong")?input.trim((period/2),Framecount(input)):input
selectrangeevery(input,period,(Goplenght*Gopmulti))
}
How can I apply slicer to this?

It gives me error, gripcrop could not save target frame size as variables, but it plays fine if only import one line.
Thanks.
Reply With Quote
  #4  
08-14-2005, 07:44 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
An avs script is not read with an import, but with an avisource !
This is what I'm currently using to find the complete read time of eight episode of a serie that I put on a single disc :

Code:
a=Avisource("509 Schizogenie.avs")
b=Avisource("510 La Poupee.avs")
c=Avisource("511 Clic Mortel.avs")
d=Avisource("512 Le Sherif A Les Dents Longues.avs")
e=Avisource("513 Patient X 1.avs")
f=Avisource("514 Patient X 2.avs")
g=Avisource("515 Compagnon De Route.avs")
h=Avisource("516 L Oeuil De L Esprit.avs")
a+b+c+d+e+f+g+h
Reply With Quote
  #5  
08-14-2005, 08:48 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
a) You still apply that ping+pong at once method returning ping+pong.
I thought we have been through this???????
Means: You getting yourself into shemes not needed for a logical programming as thats your intention finally.
Also calling a ping on one import and a pong on a second import means 2 times the avisynth's internal sourcevideo call and therefore a double!! Avisynth Memory is needed. you see the point?

So as explained some time ago:
v=import("E:\DVD Authoring Working Folder\Pitch Black\video.avs")
v_ping=v.slicer(1,15,1,"ping")
v_pong=v.slicer(1,15,1,"pong")
return v_ping + V_pong

Results in loeading the Source only ONE time (less caching and Memory usage)

or even more logical (as expl. above):

import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(2,15,1,"ping")

= SAME result, same Bits sampled and same amount used. Also NO return command needed, no variables needed.



b) I dont know whats GripCrop as Error is present here? Did you use it in the inported avs's ???

@Phil

Importing avs scripts into a present avs script is the way to go as if Global Variables are determined in the imported avs, theses ones will be recognised in the present Avs Script. If you simply load one using avisource() that means the variables out of the source avs are off.

Also speed will be your friend as the videodecoder would have to ecode 3times instead of 2 times.

decoding in the source in the import script + decoding import script via avisource() + decoding present script output.

vs.

decoding in the source in the import script + decoding only present script output.

you see
Reply With Quote
  #6  
08-14-2005, 08:51 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
An avs script is not read with an import, but with an avisource !
This is what I'm currently using to find the complete read time of eight episode of a serie that I put on a single disc :

Code:
a=Avisource("509 Schizogenie.avs")
b=Avisource("510 La Poupee.avs")
c=Avisource("511 Clic Mortel.avs")
d=Avisource("512 Le Sherif A Les Dents Longues.avs")
e=Avisource("513 Patient X 1.avs")
f=Avisource("514 Patient X 2.avs")
g=Avisource("515 Compagnon De Route.avs")
h=Avisource("516 L Oeuil De L Esprit.avs")
a+b+c+d+e+f+g+h
Thanks.
It partially works. I did obtain a green screen.
I replaced avisource with directshowsource and it worked.
But I remember that Incredible said me a time ago that it consumes more recurses.
Do you think it is ok to use directshowsource, and why avisource doesn't work?
Reply With Quote
  #7  
08-14-2005, 08:57 AM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
See my post above.

Using Directshowsource() is only your water if the roof is on fire, means if nothing else really works. but your approach above DOES work if typed correctly, so try and error till it works

- directshowsource is mega affectable via dshow filters in the system and also you cant see which colorspaceroutines really will be handled inside the system. As every individual user which uses your Apps. gots individual decoding routines in its dshow filter components.
Reply With Quote
  #8  
08-14-2005, 09:55 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
or even more logical (as expl. above):

import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(2,15,1,"ping")

= SAME result, same Bits sampled and same amount used. Also NO return command needed, no variables needed.
Oh, sorry.
Is that Im working on old code when I used that double ping + pong and I don't really realized that it is better import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(2,15,1,"ping")

Thanks for your patience.

Edited:

It is working well: import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(2,15,1,"ping")
Reply With Quote
  #9  
08-14-2005, 11:07 AM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by incredible
Importing avs scripts into a present avs script is the way to go as if Global Variables are determined in the imported avs, theses ones will be recognised in the present Avs Script. If you simply load one using avisource() that means the variables out of the source avs are off.
... and then you have the problem Pro has with Gripcrop (because it uses internal variables). I am not the one that need to be teached here, I know the diff between an import and avisource. Thanks.

When you use Gripcrop in the avs you don't have other choice than using avisource

Quote:
decoding in the source in the import script + decoding import script via avisource() + decoding present script output.
You have nothing to decode with the result of an avs : it is not encoded but raw video.
Reply With Quote
  #10  
08-14-2005, 11:34 AM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
When you use Gripcrop in the avs you don't have other choice than using avisource
Not, Phil, not, it is working ok now, see my previous post.
Reply With Quote
  #11  
08-14-2005, 12:08 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Prodater64
Not, Phil, not, it is working ok now, see my previous post.
Please don't be child ! It does not work on your PC for a codec matter, that is why you manage to have it work with directshow.
What I say about import vs avisource (or directshow or any other *source command of avisynth) because of problem with Gripcrop is still valid.

Avisynth produces an uncompressed avi, this is the base of frameserving.

RTFM
Code:
This is when AviSynth takes action. It opens the videos you referenced in the script, runs the specified filters, and feeds the output to video application. The application, however, is not aware that AviSynth is working in the background. Instead, the application thinks that it is directly opening a filtered AVI file that resides on your hard drive.
(note : where you think avisynth takes its name )
Reply With Quote
  #12  
08-14-2005, 04:15 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Dialhot
Please don't be child

If Im child, you are more than fool.
What are you saying.
I did an avs script with mpeg2source as input and removegrain, deen and gripcrop, gripsize and gripborders.
I did another avs script with the command Inc said me:

import("E:\DVD Authoring Working Folder\Pitch Black\video.avs").slicer(2,15,1,"ping")

and slicer function of course, and it works perfect.

Do you have one of those days?
Or there are something that I dont understood?

Reply With Quote
  #13  
08-14-2005, 05:02 PM
Dialhot Dialhot is offline
Free Member
 
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Prodater64
Or there are something that I dont understood?
Okay, you had changed the context. I am speaking about using TWO imports of avs scripts that both use Gripcrop into a third one.
(the situation you had in the very first post).
This can't work because of static variables that use GripFit. The first import will set them. The second import tries to set them again, but as they are already setted, you obtain the error you reported.

I thought you already understood that this was the reason of your problem. And I did not say that with only one import, this does not work (this wasn't clear in my post).
Reply With Quote
  #14  
08-14-2005, 05:15 PM
Prodater64 Prodater64 is offline
Free Member
 
Join Date: Mar 2003
Location: Palma de Mallorca - España
Posts: 2,925
Thanks: 0
Thanked 0 Times in 0 Posts
So, all is clearer than water.
Reply With Quote
  #15  
08-14-2005, 07:04 PM
incredible incredible is offline
Free Member
 
Join Date: May 2003
Location: Germany
Posts: 3,189
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to incredible
Quote:
An avs script is not read with an import, but with an avisource !
Seems you meant that in "general" which "was" WRONG! If you work with Global Variables in a source script Import() is your only chance to keep the global varaibles.

Quote:
... and then you have the problem Pro has with Gripcrop (because it uses internal variables).
Thats a known problem of serving GripCrop scripts WITHIN avisynth procedures as GripCrop gots its known core bugs.

Quote:
I am not the one that need to be teached here, I know the diff between an import and avisource. Thanks.
Ahhh Making me responsable for paying high taxes every month? :P
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
HCenc: Variable Quantization Matrix kwag Video Encoding and Conversion 26 04-29-2006 04:31 PM
Packshot: importing AVI? is there a small guide anywhere? KYUSS Video Encoding and Conversion 4 06-06-2004 01:59 PM
Error importing MPV generated with CCE to Scenarist? warpjavier Video Encoding and Conversion 1 03-20-2004 09:07 PM
DVD2SVCD: Importing avisynth scripts to dvd2svcd powie Video Encoding and Conversion 7 04-25-2003 11:38 PM

Thread Tools



 
All times are GMT -5. The time now is 10:40 PM  —  vBulletin © Jelsoft Enterprises Ltd