Log in

View Full Version : Adding date & time with avisynth


lpn1160
7th December 2003, 16:09
I apologize in advance for this post, as I'm sure the answer is all to easy. A while back I saw a post about how to add "date & time"
with avisynth. I had it saved in a file somewhere, but last week my motherboard fried & took my HDD's with it!!
Thanks all!!

d'Oursse
7th December 2003, 22:06
perhaps in this thread ? :

http://forum.doom9.org/showthread.php?s=&threadid=61688

oof
8th December 2003, 18:18
Here's one:



# Add time to a movie
CR = chr(13)
SP = " "

t = 0.0

avisource( "movie.avi" )

W = Width
H = Height
ftime = 1.0/Framerate

ScriptClip( last , " t = t + ftime " + CR + \
" s = time_str( t ) " + CR + \
" Subtitle( s , x = (W/2) , y = (H-20) ) " )

return( last )


# Returns a string representing "sec" seconds in HH:MM:SS.SSS format

Function time_str( float sec )
{
f = int( (Frac(sec) * 1000.0) + 0.5 )
t = int( sec )

ss = t % 60
t = t / 60
mm = t % 60
t = t / 60
hh = t

str = LeftStr( ( "0" + String( hh ) ) , 2 ) + ":" + \
LeftStr( ( "0" + String( mm ) ) , 2 ) + ":" + \
LeftStr( ( "0" + String(ss ) ) , 2 ) + "." + \
LeftStr( ( String(f) + "00" ) , 3 )

return( str )
}

oof
8th December 2003, 18:22
Sorry , I just noticed you wanted Date too
Oh well it's close