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. |
|
|
Thread Tools | Search this Thread | Display Modes |
20th June 2012, 11:29 | #1 | Link |
Registered User
Join Date: Jun 2011
Posts: 2
|
Script help needed to label video frames sequentially every 3 frames
Hello,
Hopefully someone may be able to help me out here? I need a script that will label video frames sequentially every 3 frames. At the moment I have a method for what I need to do where I take in a video file, and I have to select every third frame. In my video files only 1 out of each 3 will be any good, so currently I use the following bit of script and have to check out all 3 by trial and error: Selectevery (3,0) #selectevery (3,1) #Selectevery (3,2) What I'm hoping to work out how to do is to get an avisynth script to stamp the number 0, 1 or 2 onto each frame so that I can examine the whole file in one go, decide which of the 3 is good, and then select the relevant selectevery line as above without having to try all 3 all the time. I tried messing around with modulo functions, but my script writing is pretty rudimentary, and I suspect there is probably a blindingly obvious way of doing this that I don't know about! Thanks! |
20th June 2012, 23:40 | #3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
ScriptClip compiles a new Subtitle filter chain every frame. The Subtitle filter is particularly slow to initialise. The ShowFrameNumber and like text tagging variant suffers quite badly from this delay in setting up per frame variable text.
A significantly faster, but clumsier implementation. This is an all compile once at the script start solution :- Code:
...Source... A=SelectEvery(3, 0).Subtitle("0") B=SelectEvery(3, 1).Subtitle("1") C=SelectEvery(3, 2).Subtitle("2") Interleave(A, B, C) ... Code:
...Source... T0=Subtitle("0") T1=Subtitle("1") T2=Subtitle("2") ConditionalSelect(current_frame % 3, T0,T1,T2) ... The above 2 solutions will be roughly the same speed. The selection criteria here, (current_frame % 3), is quite trivial, but other scripting needs may be a lot more expressive perhaps involving runtime functions like AverageLuma() and friends that may see a significant advantage. |
|
|