Greetings all. I'm working on an Avisynth script to use in my anime encodes and I was wondering if there was an array type or a for loop-like expression in Avisynth. I didn't find any mention of either in the documentation, but since I read somewhere in this forum that the documentation often lagged behind the reality I thought I'd ask.
I'm writing a function that iterates over a clip, performs an operation on each frame, and uses the results to create a metric. I want the number of samples it takes from the clip in question to be user-defined. This means that I need something to hold the values for me while the script takes a look at each frame in the clip. It's nonsense for me to use variables like this: Code:
Well, if you really want to, you could use strings as a poor-man's array. First you'd write a recursive function with a string as its accumulator; something of the form: Code:
The Kluge consists of writing a compare log to a file with: avisource( "movie.avi" ) v2 = trim( last, 1,0 ) Compare(last, v2, "", "compare.log", true) then run AWK $2 == 0 {print "DeleteFrame( " $1 " )" "\r" } now we have another AVS which deletes all the desired frames. If it was C I would write output( Frame[ FIRST_FRAME ] ) ; for( i = FIRST_FRAME + 1 ; i <= LAST_FRAME ; i++ ) { if( Frame[ i ] != Frame[ i - 1 ] ) output( Frame[ i ] ; /* Else skip this one */ }
No, idea what the smartest way is. Maybe the following works: 1) subtract frame j and j+1 2) if averageluma of the resulting frame is close to 128 (check that by using ScriptClip) => delete that frame
This is a nasty one. DeleteFrame reqires a frame number. What if you delete frame N ? How are they numbered after that ? I deleted them High numbers first to avoid that. Another problem with the Kluge method is that the first AVS that does the compare won't execute on all frames unless you frames serve to something that reads all the frames. The only thing I could think of was play it in Vdub. That takes 2 hours if it's a 2 hour movie. If I had /dev/null I could send it there as an AVI, does window have a null file ? Anybody know of a frameclient that requests frames as fast as it can go ? Another AVS might do. I don't really NEED to do this, I just want to solve the puzzle.