View Full Version : FrameNumber clip property?
Prettz
30th June 2003, 14:43
Currently, as far as I know, the only way to display the current frame number for each frame is with the Info() filter. It would be really really nice if there was a FrameNumber() clip property, so that it could be added to a string being passed to Subtitle (for instance, if you're combining pieces of clips from multiple sources together using Trim, it would let you make a test to ensure that you did it correctly).
This would be kind of different from the other clip properties, since it changes on a frame by frame basis; however I think it would be more than worth making a special case for.
Wilbert
30th June 2003, 14:54
http://www.avisynth.org/index.php?page=Showframes
Btw, info doesn't show the framenumber (it only shows properties of the clip).
Prettz
30th June 2003, 19:46
Wow I have no idea how I missed that one.
And Info() does indeed show the framenumber for each frame.
redfordxx
10th August 2005, 23:06
Hi
Can I get somewhere only the numeric variable "CurrentFrame"?
Thanx much
R.
Mug Funky
11th August 2005, 03:09
ScriptClip("subtitle(string(current_frame))")
"current_frame" is an int value, so you can use it for calculations and stuff.
only problem is you'll have to acquaint yourself with avs's rather evil conditional environment :)
stickboy
11th August 2005, 04:52
Can I get somewhere only the numeric variable "CurrentFrame"?It doesn't make any sense outside of ScriptClip/FrameEvaluate.
Why do you need it? It's usually better to avoid it if possible.
redfordxx
11th August 2005, 09:23
Why do you need it? It's usually better to avoid it if possible.Why avoid...?
I want to "analyze" some dance/music videos and I want do display measures and beats of the music on the screen.
So something like:beats_in_measure=8 #two 4/4 measures
measure_length=60/42*2*clip.Framerate #salsa 42 BPM (coupled measures)
offset=5*clip.Framerate #music starts after 5 seconds
ScriptClip("subtitle(string((current_frame-offset)\measure_length) + "-" + string(((current_frame-offset) % measure_length)/beats_in_measure))")probably some time info would be good too...
So as I understand ScriptClip is necessary...? Can I write more lines in ScriptClip?
Does work this?
ScriptClip(my_cf=current_frame)
#use my_cf here
stickboy
11th August 2005, 18:04
Why avoid...?IMO ScriptClip/FrameEvaluate are slow, complicated, hard to understand, and very un-filter-like.
So as I understand ScriptClip is necessary...? Can I write more lines in ScriptClip?
Does work this?
ScriptClip(my_cf=current_frame)
#use my_cf hereNo, that doesn't make any sense. An AviSynth script is evaluated when the script is loaded. ScriptClip/FrameEvaluate work because you give them a chunk of code and they evaluate it every time they access a frame. They have no knowledge of anything you do outside the ScriptClip/FrameEvaluate call.
If you want multiple lines, you should be able to do:
ScriptClip("line1
line2
line3")But I'm not ScriptClip/FrameEvaluate expert. Like I said, I try to avoid it.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.