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. |
2nd July 2003, 20:31 | #1 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,370
|
scriptclip problems
I was trying scriptclip (on some almost black frames), and got the following output:
# gives 43.66 clip = clip.Trim(0,-1) ScriptClip(clip, "Subtitle(String(AverageLuma(clip)))") # first frame: 43.656 # second frame: 43.395 # third frame: 43.405 clip = clip.Trim(0,-3) ScriptClip(clip, "Subtitle(String(AverageLuma(clip)))") # gives 0.00002 clip = clip.Trim(0,-1) ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))") # first frame: 2.271 # second frame: 0.00002 # third frame: 2.137 clip = clip.Trim(0,-3) ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))") There are two things which I don't understand: 1) Mustn't the order in the last example be 0.00002, 2.271, 2.137 instead of 2.271, 0.00002, 2.137. 2) Even then, I don't understand these values. I also added the calculation of averageluma. The difference between the first two frames, for example, is 43.656 - 43.395 = 0.261. Which is not approx. equal to 2.271? |
3rd July 2003, 00:31 | #2 | Link |
Registered User
Join Date: Apr 2003
Location: Italy
Posts: 15
|
I posted something very similar a few days ago.
http://forum.doom9.org/showthread.ph...threadid=50105 But no answer. Bye Cross |
3rd July 2003, 21:24 | #4 | Link |
Moderator
Join Date: Nov 2001
Location: Netherlands
Posts: 6,370
|
One more question, if you don't mind I'm trying to understand the "Quantified Motion Filter: adaptive motion filter for Avisynth", in the thread: http://forum.doom9.org/showthread.php?s=&threadid=56051
This script: # first frame: 2.271 # second frame: 0.00002 # third frame: 2.137 # fourth frame: 2.252 clip = clip.Trim(0,-4) ScriptClip(clip, "Subtitle(String(YDifferenceFromPrevious))") gives exactly the same output as the following script: clip = clip.Trim(0, -4) function g(clip c) { global clip=c c=ScriptClip(c, "debug()") c=FrameEvaluate(c, "me") c=FrameEvaluate(c, "global text=YDifferenceFromPrevious(clip)") return c } function me() { global t=String(text) } function debug(clip c) { c = subtitle(c, t) return c } g(clip) The problem is that I don't understand what is happening here. If you look at the function "g" it appears that the script is executed backwards (instead of forwards, which is normally the case). Thus the globale variable "text" is obtained, and used by the function "me" [which is located above that line]. Then the "debug" function is applied [which is located above that line]. I know that AviSynth parses (or reads) from bottom to top, so I guess that has something to do with it. I just don't understand this, and I'm so confused |
3rd July 2003, 22:15 | #5 | Link | |
Registered User
Join Date: Jul 2002
Location: France
Posts: 140
|
Wilbert wrote:
Quote:
If an explanation is possible, I'd like to hear/read it. Thanks sh0dan (I won't get bored by saying it again and again ). |
|
3rd July 2003, 22:25 | #6 | Link |
Retired AviSynth Dev ;)
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
|
It because of how AviSynth works.
Scripts are parsed from top to bottom, but when a frame is requested the last filter is actually being invoked first, requesting frames upwards in the filter chain. For example: AviSource("myfile.avi") ColorYUV(analyze=true) Histogram() - When Vdub requests a frame, AviSynth requests the frame from Histogram. - Histogram requests a frame from ColorYUV, - ColorYUV from AviSource, which produces the frame, and delivers it to ColorYUV. - ColorYUV processes the image and sends it on to Histogram, which returns it to Vdub. So the filter chain basicly works backwards, which gives filter the possibility to request several frames from the source above. Conditional filters need to evaluate scripts BEFORE they request frames from the filter above, because they need to know which filter to call. I guess I owe it to you to write some decent explanation of this. Cond. filters are quite complex - and sometimes I am even surprised of the outcome.
__________________
Regards, sh0dan // VoxPod |
Thread Tools | Search this Thread |
Display Modes | |
|
|