Log in

View Full Version : Time incrementer


HighInBC
28th February 2003, 18:25
Perhaps I have missed it, I have found a filter that shows the current frame number on each frame. I need something similiar to it.

I would like to be able to use a cmd that lets me give it a time(seconds since the epoch), and it will bring that time up on the screen, formatted for viewing proper, and then increment properly in future frames.

something like this:

TimeStamp(clip , INT time , [same param's as subtitle])

so that I can take the timestamp my DV camera puts on each clip, and label each clip. I am recording public rallies, and I would like to show to the view when each scene happened. Any help would be appreciated, thanks!

DDogg
7th March 2003, 21:08
@Developers Since I am finding it better to be precise; Would it be possible for you folks to add a time and date variable? Like the %time% and %date% in the Command line? If it is possible, will you? :-)

sh0dan
7th March 2003, 21:14
@HighInBC:
ShowFrameNumber() will show the current frame number.
ShowSMPTE(fps) will show a timecode.

Both are god-awful ugly - maybe sometime soon they could get an update or someone could code a good filter for this!?!?

@DDogg:It will of course reflect the current time, when the script was initiated. I assume this is what you're talking about.

bilu
7th March 2003, 21:19
I think a timestamp filter is relatively easy to do, even in a AVS function, IF you're not making hybrid/ variable framerate movies ( i'm not the best guy to talk about this :) )

Basically all we need is this:

framecount / framerate = time in seconds

Example: 75 frames / 25 fps = 3 seconds

Then you need divisions for minutes, hours, but it's really easy (if I understood what you want, that is :) )

[/EDIT] Sh0dan, you posted first :) [/EDIT]

Bilu

bilu
7th March 2003, 21:36
@Ddogg


Best way for W2k and XP seems to be:

INFO.BAT
=========
del c:\info.avs
for /F "usebackq" %%i IN (`time /t`) DO @echo Time=%%i >> c:\info.avs
for /F "usebackq" %%i IN (`date /t`) DO @echo Date=%%i >> c:\info.avs

In AVS script
==============
CALL(BlankClip,"c:\info.bat","-2")
Import("c:\info.avs")


Bilu

DDogg
7th March 2003, 21:52
@sh0dan - This may be another of my hairball idea to use in reportage. I was thinking of getting elapsed time, but I may be slipping back into the batchfile mentality again which doesn't work in avisynth with no "beginning" and "end". I was thinking I could figure some way to that. The ShowFrameNumber() and ShowSMPTE(fps) is good lead.

@bilu, Stop reading my mind! :D Well at least there are two of us now with hairball ideas :-) edit: oh, that last example you gave is way slick! Thanks!

add: I think you would add quotes so avisynth imports properly?

del c:\info.avs
for /F "usebackq" %%i IN (`time /t`) DO @echo Time="%%i" >> c:\info.avs
for /F "usebackq" %%i IN (`date /t`) DO @echo Date="%%i" >> c:\info.avs
That will yield an info.avs file that contains:
Time="04:10"
Day="Fri"

bilu
8th March 2003, 01:35
@Ddogg

You're right :) . Now check my function to avoid Eval and TeX notation please. (http://forum.doom9.org/showthread.php?threadid=47972) :D

Sorry for my behavior (hijacking the thread :eek: )

Bilu

bilu
8th March 2003, 02:04
The only thing that I don't like about my actual batch approach is that it depends on the FOR command for almost everything (getting size into a file, getting text from a file into a variable, parsing command output to a variable) and this functionalities of FOR do not exist on prior versions of Windows, so it's limiting our range of users! :scared:

Bilu

DDogg
8th March 2003, 02:18
I am afraid I am the one who hijacked HighInBC's thread, but it had scrolled off so I thought he would not mind a free bump :)

Yes, we need to just be able to directly echo out a simple time="12:30" to a text file. I can't figure out how to get the quotes on it without an itermediate batchfile. That's ok, but just not as clean. Echo is going to work for anybody I would think. Quotes within quotes are giving me a very bad couple of days! :devil:

Bilu, here is a shorthand version of what I was thinking using your info.bat. Everything works fine intil the last two lines are added. Until then it properly executes at the first frame and then the last frame. I can't figure it out. You are much more adept so maybe you can.

LoadPlugin("call_25.dll")
version
testcmd="info.bat"
Call(testcmd, "0")
Import("info.avs")
starttime=time
Call(testcmd, "-1")
Import("info.avs")
lasttime = time

bilu
8th March 2003, 13:49
Ddogg,

I tried this:



Loadplugin("D:\avs_filters\avs25\CALL_25.dll")
BlankClip(2400)
testcmd="D:\avs_filters\avs25\tests\analyse\info.bat"
Call(testcmd, "0")
Import("D:\avs_filters\avs25\tests\analyse\info.avs")
starttime=time
Subtitle(y=50,"Start at "+starttime)
Call(testcmd, "-1")
Import("D:\avs_filters\avs25\tests\analyse\info.avs")
lasttime = time
Subtitle(y=100,"End at "+lasttime)



and there is a problem: we still have no way ( at least that I know of ) to know if a specific Call command has run. The only thing I can remember is too twisted :rolleyes: :

LAST.BAT
========
del /q last.avs
echo last=true > last.avs

AVS script
==========
testcmd="info.bat"
call("last.bat,"-1")
Call(testcmd, "-1")
Exist("last.avs")? Import("last.avs"):nop()
last=true ? Import("info.avs"):nop()
last=true ? Subtitle(y=100,"End at "+time):nop()

I will try it to see if it works.

Bilu

bilu
8th March 2003, 14:46
@Ddogg

My syntax is wrong, but I posted a thread (http://forum.doom9.org/showthread.php?s=&threadid=48127)
with a very important question for us to proceed. :rolleyes:


Best regards,
Bilu

DDogg
8th March 2003, 15:24
Bilu, just out of curiosity, do you think it is possible to use the CALL command within a function?

bilu
8th March 2003, 16:01
I tried



function Starttime(clip c) {
cmd_info="D:/avs_filters/avs25/tests/analyse/info.bat"
avs_info="D:/avs_filters/avs25/tests/analyse/info.avs"
Call(cmd_info, "50")
Import(avs_info)
return Subtitle(c,y=50,"Start at "+time)
}

Starttime()



Import() works, CALL doesn't :confused:
I tried using / instead of \ because it still works and I was afraid it didn't work because of this:

Avisynth statements can be split across multiple lines by placing a backslash ("\")

Maybe we should get Nic's opinion, because of this:

and there is a problem: we still have no way ( at least that I know of ) to know if a specific Call command has run

and the usage of CALL inside a function as you posted.

BTW, check Sh0dan's answer on the WHILE functionality (http://forum.doom9.org/showthread.php?threadid=48127) . :scared:


Best regards,
Bilu

PS: I wonder if it would be possible to somehow discard imported scripts? :rolleyes: