digitalFAQ.com Forums [Archives]

digitalFAQ.com Forums [Archives] (http://www.digitalfaq.com/archives/)
-   Avisynth Scripting (http://www.digitalfaq.com/archives/avisynth/)
-   -   Avisynth: Importing avs and assigning to a variable. (http://www.digitalfaq.com/archives/avisynth/13748-avisynth-importing-avs.html)

Prodater64 08-14-2005 05:31 AM

Importing avs and assigning to a variable.
 
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.

incredible 08-14-2005 06:36 AM

Re: Importing avs and assigning to a variable.
 
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

Prodater64 08-14-2005 06:56 AM

Re: Importing avs and assigning to a variable.
 
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.

Dialhot 08-14-2005 07:44 AM

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


incredible 08-14-2005 08:48 AM

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 :)

Prodater64 08-14-2005 08:51 AM

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?

incredible 08-14-2005 08:57 AM

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.

Prodater64 08-14-2005 09:55 AM

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, :imstupid: 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")

Dialhot 08-14-2005 11:07 AM

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.

Prodater64 08-14-2005 11:34 AM

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.

Dialhot 08-14-2005 12:08 PM

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.

:arrow: 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 ;-))

Prodater64 08-14-2005 04:15 PM

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?

:screwy:

Dialhot 08-14-2005 05:02 PM

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).

Prodater64 08-14-2005 05:15 PM

So, all is clearer than water.

incredible 08-14-2005 07:04 PM

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


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

Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.