|
|
| whugemann |
| Posted: Oct 28 2004, 09:01 AM |
 |
|
Unregistered

|
I know about "ShowFrameNumber" and "ShowSMPTE". The latter shows now real time but also counts frame numbers at time increments smaller than 1 s. Furthermore, it cnnot be used for videos with 50 fps like those resulting from the BOB filter.
I would like to generate a stopwatch and my first (successfull) attemt is:
clip=Subtitle(clip, "0.00",first_frame=1,last_frame=1,font="Arial", size = 72, x = 500, y = 500, text_color = $FF0000) clip=Subtitle(clip, "0.02",first_frame=2,last_frame=2,font="Arial", size = 72, x = 500, y = 500, text_color = $FF0000) clip=Subtitle(clip, "0.04",first_frame=3,last_frame=3,font="Arial", size = 72, x = 500, y = 500, text_color = $FF0000) ... ... Subtitle(clip, "1.00",first_frame=51,last_frame=51,font="Arial", size = 72, x = 500, y = 500, text_color = $FF0000)
One may generate this repeative code by the use of Excel, but I wonder wether there is a more elegant approach to the problem.
I think, the use of the "Animate" meta filter is excluded, because we have a string parameter in the parameters list.
Any suggestions? |
 |
| NuPogodi |
| Posted: Oct 28 2004, 10:39 AM |
 |
|
Advanced Member
  
Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03

|
Do you need something like this? not too elegant, but... hopefully, better than Excel-generated version (at least, it has to work at any framerate )
function FrTime(clip clip,int frame,float fps) { ct=float(frame)/fps hh=int(ct/3600) str = String(hh)+":" ct=ct-hh*3600 mm=int(ct/60) str = (mm<10) ? str+"0"+String(mm)+":" : str+String(mm)+":" ct=ct-mm*60 ss=ct-int(ct/60) str = (ss<10) ? str+"0"+LeftStr(String(ss),5) : str+LeftStr(String(ss),6) return str }
clip=AVISource("Bonus.avi") ScriptClip(clip,"subtitle(FrTime(clip,current_frame,framerate(clip)),align=3)")
-------------------- Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right... |
 |
| whugemann |
| Posted: Oct 28 2004, 02:32 PM |
 |
|
Unregistered

|
Many thanks, works great!
Your script contains two decisive hints: the special filter "ScriptClip" and the runtime variable "current_frame". The latter is not explained in the documentation. The English version of the documentation contains an example how to use this varianle in connection with "ScriptClip":
ScriptClip("subtitle(string(current_frame))")
That's very near to the stopwatch! Regrettingly, this example is missing in the German documentation, where I took a look.
To my opnion, what's really needed in AVIsynth's documention would be a bunch of examples solving real problems. Couldn't it be amended that way?
Thanks again! |
 |
| NuPogodi |
| Posted: Oct 29 2004, 04:02 PM |
 |
|
Advanced Member
  
Group: Members
Posts: 536
Member No.: 6558
Joined: 1-October 03

|
| QUOTE (whugemann @ Oct 28 2004, 08:32 AM) | | Regrettingly, this example is missing in the German documentation, where I took a look. | Glucklichwise, Ich kan nicht lesen und schreiben Deutsch (wie noch 4 Millionen menchen in Deutchland ).
-------------------- Optimists believe that they live in the best of existing worlds. Pessimists are afraid of that's right... |
 |
|